Enum types for SQLite schemas #275
-
So since SQLite doesn't support enum types, is there a way to (better) safely cast data from prisma to rust ? This is what I'm currently doing with my schema model Account
id String @id @default(cuid())
role String // supposed to only take User or Admin enum Role {
User,
Admin
}
fn cast_role(role_taken_from_prisma: String) -> Result<Role, CastError> {
// cast logic and handle errors
} |
Beta Was this translation helpful? Give feedback.
Answered by
Brendonovich
Mar 14, 2023
Replies: 1 comment
-
Yeah that's about as good as it gets, implementing |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mnpqraven
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah that's about as good as it gets, implementing
FromStr
may be a bit more ergonomic but the same problem still applies.