I'm dealing with a database that has some tables whose primary key and a few other columns is a UUID, but the case of the string is all lowercase (e.g. '0ff26611-9382-43e8-9b0a-abfdd1602076') and doesn't match that of the format produced by Swift's UUID.
This caused issues with queries until I implemented the DerivableRequest filter() suggestion in the Good Practices doc. That solved the issue with reads, but didn't solve the problem when it comes time to do an update. Basically, I get an error that there is no key item found for the uppercased UUID.
I'm trying to stick with UUID as the type for these columns, but I suppose I could go with String. I'm just trying to avoid marshaling Strings to UUID and back if I don't have to. The struct's properties look like this:
var guid: UUID // primary key
var clientGuid: UUID?
var typeGuid: UUID?
var subtypeGuid: UUID?
I thought about "migrating" the database by inserting new records with the String values converted to UUIDs and then deleting the original records. That works, but I'm wondering if there is some better or simpler solution that I'm missing.
I'm moving the code from the other language that supports the format of the spec to Swift, so I'm not really worried about two different code bases accessing the same database.
Thoughts on how to best go about dealing with this?