haven't researched too much yet, but kinda thinkin...
# random
c
haven't researched too much yet, but kinda thinking out loud. im Implementing a database for the first time in a while. still might go room or sqldelight. i want to have a column that accepts an enum. should i just make it a string or an int, or is there a way to actually have an enum in a sqlite db?
h
Some sql dialects support custom types, but afaik not sqlite.
c
Ask in #C7KS458SJ
There was some recent update around value classes I think. Not sure about enums
s
I think there is no need for custom enum types. I give all my enums a unique ID and save it as int with sqldelight. Saving enum names as String removes the ability to rename them later. And saving the ordinal is just an huge accident waiting to happen.
👍 2
c
looks like sqldelight has support for exactly this:
As a convenience the SQLDelight runtime includes a
ColumnAdapter
for storing an enum as String data.
https://cashapp.github.io/sqldelight/2.0.0-rc01/jvm_mysql/types/
going to use that for now
v
Room has support for enums too I think
But yeah I'd use sqldelight in your place for other reasons