How to assign a default value to existing rows via Ash.postgres generated migration code
When a non-null column is added, is there a way to specify a default value to assign to the new column for existing records?
I believe in Ecto, it's done something like this, but I'm curious if this can be done through Ash DSL.
If it makes a difference, the new column in my case is a source attribute for a relationship as in something like this. (So manually adding
default: "default value"
actually causes a foreign_key_violation., which is a different issue on its own.)
`2 Replies
For that one if you define the
theme_id
attribute yourself you can then set a default
Then set define_attribute false
to prevent the relationship from trying to also add that attribute mOkay. Thank you!