Replies: 1 comment
-
Currently I use this workaround to build the column default expression including all enum variants: let enum_name = FactKind::db_type().get_enum_name().unwrap().to_string();
let enum_values = FactKind::values()
.iter()
.map(|val| format!("'{}'", val))
.collect::<Vec<_>>()
.join(", ");
let default_expr = SimpleExpr::Custom(format!("ARRAY [{}]::{}[]", enum_values, enum_name)); I don't like it 😿 |
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
-
I'm writing a migration which adds a new column to the existing table:
The
FactKind
is a enum declared like this:When trying to run the migration it gives the error:
Postgres logs:
What's the idiomatic SeaQL way to prepare the default array value to make it contain not just text identifiers, but proper enum variants (text ident's casted to its Postgres type)?
Beta Was this translation helpful? Give feedback.
All reactions