Rather than using the implicit Orgs id, I want to ...
# exposed
m
Rather than using the implicit Orgs id, I want to reference on the Orgs (and Users) uid, which is a unique string. What’s the proper syntax for defining OrgMembership in that case? IntelliJ complains that
val org by Org referencedOn OrgMemberships.orgId
has a type mismatch, where it expects a
Column<EntityId<Int>>
but gets a
Column<EntityId<String>>
. How do I tell OrgMembership to use that string?
t
Why then you use IntIdTable, instead of IdTable<String>() ? Please look on declaration of UUIDTable class.
m
But if I use that, then I lose the implicit int id as PK on the Orgs table, right? What I was hoping to do was to use a column that is unique but is not a PK as an FK reference, which is something MySQL supports…
t
It's not so easy to implement with some "quick-fix", because it requires to rework current references implementation. I created issue https://github.com/JetBrains/Exposed/issues/282 to support it in future
m
Gotcha. Figured it might still be a missing feature. Didn’t think to look through the open issues.
So, I can either change Orgs and Users to be String entity IDs, and then use the UUID, or I can leave them as IntEntityIds and do the join on the int IDs.
Thanks for clarifying.