aaronpearce / Harmony

Harmony provides CloudKit sync for GRDB and only GRDB.
Other
142 stars 10 forks source link

Replacing UUID Requirement? #9

Open autoreleasefool opened 5 months ago

autoreleasefool commented 5 months ago

I started investing Harmony for my project, which has a number of tables and pivot tables. The pivot tables have primary keys that are just the 2 UUIDs for each of the tables it connects. If I understand correctly, Harmony requires HRecord types have a UUID ID, which these pivot tables lack.

I suppose I could add a third column to this table, which would just be a UUID for the row itself, though it isn't technically necessary.

I took a brief shot at refactoring HRecord to use a generic ID that could be encoded/decoded from a String, but the type erasure I tried threw me off.

Do you think this is technically feasible? Is there a reason for the UUID requirement besides ease of implementation?

I don't mind taking a shot at implementation

aehlke commented 1 month ago

I don't have this fork of another iCloud sync project (SyncKit, for CoreData and Realm/RealmSwift; which I reduced to RealmSwift only) https://github.com/lake-of-fire/BigSyncKit but I have the ID part working well, you can see this as an example reference implementation if you like. See things around recordName. You can use UUID or other types flexibly - I like having a compound string ID that I generate, for instance.

aaronpearce commented 1 month ago

There is no technical reason that UUID are required. It was just a specific implementation I was already doing. It could be generalised down to anything that can be converted a CloudKit ID.