Prisma Enum

Hi guys! Do you know how to define an enum prisma database type with Wasp ?
14 Replies
Fecony
Fecony2y ago
Hi @0xtlt, It's not possible yet, Here is a Github issue to track that https://github.com/wasp-lang/wasp/issues/641
GitHub
Expand our Prisma support (enum, type, other dbs, ...) · Issue #641...
Wasp is heavily using Prisma for the DB layer of web app, but it doesn't yet utilize everything that Prisma offers. Here we can track some of the bigger items that we recognize would be cool to...
martinsos
martinsos2y ago
Thanks @Fecony !!! Yes, we do plan to add it for sure, but not there yet, it will probably come together with some other bigger changes.
0xtlt
0xtlt2y ago
Alright, thanks guys 🙏
cgduzan
cgduzan12mo ago
I'm a little late to the party, but I was also looking for a way to use enums. Looks like it's not available at the moment, so do you guys have a suggested workaround for the time being?
martinsos
martinsos12mo ago
@cgduzan not really, but we are going to be handling this soon (this quarter) -> supporting all the Prisma features, like enums, views, types, ... .
cgduzan
cgduzan12mo ago
Sounds good! Thanks for the update!
owopi
owopi9mo ago
any updates on the progress? its been a while and im also looking to use it
martinsos
martinsos9mo ago
@owopi so the plan was to have it released as a part of 0.12 release, which is coming out in a next week or so, but we at the end didn't manage to squeeze the Prisma changes in. My fault, I was supposed to work on that, but other work just took over. That said, this will be the main thing we will be attacking after 0.12 -> big overhaul how Prisma is used in Wasp, unlocking a lot of things. So wait will have to be a bit longer, but it is coming!
owopi
owopi9mo ago
alright, that's nice to know, thank you for your work!
ldeavila
ldeavila8mo ago
Just got a workaround fully working for Postgress 1) Created a seeder function that use $executeRawUnsafe to create the enum. 2) Upgraded to prisma 5.10.2. Version shipped with wasp crashes Prisma Studio if an enum is defined in the db
ldeavila
ldeavila8mo ago
Hope that helps
martinsos
martinsos8mo ago
Oh this is wild, nice work @Ideavila! What I would be wary of though is that Wasp to some degree assumes it works with Prisma 4, not Prisma 5, so you might end up with some other stuff braeking / suffering because of this. THe real fix is what I described above, Wasp changing how it works with Prisma, to allow all of its features, which is something that will be one of the very next bigger changes on Wasp.
ldeavila
ldeavila8mo ago
Fully agree that this was a hack. 😜 I actually ended up going a different direction with the authorization design so I killed this approach. I'll share my experiences in a separate thread.
martinsos
martinsos8mo ago
Awesome, pls do share!
Want results from more Discord servers?
Add your server