I have a migration which adds a foreign key to the users table.
[timestamp]_add_group_id_to_users.rb
Inside this migration file, I'm specifying a default value for it:
def self.up
add_column :users, :group_id, :integer, :default => 1
end
But what happens after a while when let's say a user has now group_id: 4
and another feature will be pushed to production?
Will all the migration files be run again? Will group_ids of users be overwritten?
Should I specify something like "overwrite it if group_id is nil but don't do it if it's not and if it's different from 1" ?
Aucun commentaire:
Enregistrer un commentaire