About the lack of enums in SQLite: there's no need for them to ensure valid strings #592
fernandocanizo
started this conversation in
Show and tell
Replies: 1 comment
-
Great tip. Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I was reading the decisions document on SQLite and I came across this part:
(cuttings and highlights are my own)
I also read issue #29 , where a Prisma example is given.
I didn't want to reopen the issue, but I wanted to add that you don't need no Prisma thingy. To ensure all values of a column are only within a set of specific possible values just use a table and foreign keys.
For example, if you wanted to have an enum like:
You can just create a
direction
table like this:And then use it like this:
And with that you ensure you cannot insert into example any other value than the ones hold by
direction
table, for example:Beta Was this translation helpful? Give feedback.
All reactions