Document adding a default value to an existing column
Opened this issue · 5 comments
notramo commented
The table has a column already, with no default value. I want to add a default value to it without changing anything other.
jwoertink commented
alter table_for(Post) do
change_default published_at : Time, default: :now
end
notramo commented
As far as I know, it's not documented anywhere.
jwoertink commented
Nope, not currently luckyframework/website#1077
notramo commented
@jwoertink Is it possible to remove a default value from a column?
ALTER TABLE users ALTER COLUMN role DROP DEFAULT;
jwoertink commented
There's no helper method to do that, but you can just run the raw SQL like you have.