Reputation: 20538
I am building an Rails 3.2.6 app and I need to add a default value to a column on an already created table called tasks. How can I do this with a migration?
Thanks!
Upvotes: 1
Views: 83
Reputation: 239240
Use change_column(table_name, column_name, type, options = {})
:
def up
change_column :tasks, :my_column, :integer, :default => 1
end
Upvotes: 4