DT
Drizzle TeamSpeilegg
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!
Speilegg•18d ago
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 🙂
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
7.4KMembers
View on DiscordWant results from more Discord servers?
More PostsHow can I get a better structured response when querying a table (many to many)?Hi, I am new to sql. This might be obvious, but I'm not sure how to go about this. Below is a simplisql where column md5Hey, how can I achieve the following statement in drizzle?
```sql
-- mysql
SELECT * FROM podcasts_Error on Query Filter: Types of property 'table' are incompatible.I'm currently trying to filter a query as [explained in on the docs](https://orm.drizzle.team/docs/rHow to do Computed Fields / Manipulate data at Query Level?I'm looking for something like this, on prisma we can validate fields when querying the model. I cou