I am trying to write a migration to handle the null -> '' conversion but it doesn't seem to be working. I have:
def up
change_column :items, :detail, :text, :default => ''
end
Is this correct syntax?
thx
I am trying to write a migration to handle the null -> '' conversion but it doesn't seem to be working. I have:
def up
change_column :items, :detail, :text, :default => ''
end
Is this correct syntax?
thx
That looks about right.
You should be aware, however, if you're using MySQL you can not set a default value to a TEXT or BLOB field.
Use should use change_column_default(table_name, column_name, dafault_value)
This question has been already asked here:
Rails migrations: Undo default setting for a column