Open chaner opened 7 years ago
@chaner Were you having an issue with this when calling something like this?
add_column :some_large_table, :some_column, :string
Just want to verify that you weren't using the default
option when you noticed this issue e.g.
add_column :some_large_table, :some_column, :some_type, default: "some-default-value"
I would have thought it was the default that caused adding the column to be slow. Adding a column is very fast (at least with Postgres). Defaults are also fast if you are using postgres versions > 11
We have found that adding columns to large database tables with default transactions turned on is unsafe. It will lock the table and do bad things. This PR will throw an error if a column is added without turning off ddl transactions.