Enum as primary key for roles (sqlite)
I'm pretty new to Drizzle and database schemas in general so bear with me if this is stupid.
I'm creating a crud application with some users with a role table. The roles are quite defined so I thought I can use a enum with the role "slug" as the ID:
This does seem to work (is it a good idea though?) but the inferred roleId when querying is a string. Only when I join it is a string literal/enum:
Is this intended? Is this a bad pattern? Any feedback would be greatly appreciated!
1 Reply
I guess rubber ducking this helped me with the inferring as I can specify the enum on the organizationUsers table:
Still would love to hear any thoughts on this pattern in general 🙂