So wanted to add a default value for a column, but also wanted to do a proper rollback method on the migration. My problem may have been more with SQLite than rails, something about it not liking alter column commands.
Anyway:
change_column :table, :column, :type, default = 'value' did update the schema.
But also needed to add the date
Table.update_all( "column = 'value'", "column IS NULL") to fix unset values.
Didn't find a good syntax to remove the default setting from the schema.
Showing posts with label rails rails-db-migration. Show all posts
Showing posts with label rails rails-db-migration. Show all posts
Saturday, April 2, 2011
Subscribe to:
Posts (Atom)