luckyframework/avram

Document adding a default value to an existing column

Opened this issue · 5 comments

The table has a column already, with no default value. I want to add a default value to it without changing anything other.

alter table_for(Post) do
  change_default published_at : Time, default: :now
end

As far as I know, it's not documented anywhere.

Nope, not currently luckyframework/website#1077

@jwoertink Is it possible to remove a default value from a column?

ALTER TABLE users ALTER COLUMN role DROP DEFAULT;

There's no helper method to do that, but you can just run the raw SQL like you have.