Harmony icon indicating copy to clipboard operation
Harmony copied to clipboard

Replacing UUID Requirement?

Open autoreleasefool opened this issue 1 year ago • 2 comments

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

autoreleasefool avatar Apr 07 '24 00:04 autoreleasefool

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.

aehlke avatar Jul 23 '24 16:07 aehlke

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.

aaronpearce avatar Jul 29 '24 08:07 aaronpearce