我对Ruby和Rails还比较新,正在努力理解迁移。 我的问题是回滚后删除迁移的最佳实践或正确时间是什么。到目前为止,据我所知,是否删除迁移文件在某种程度上取决于个人意见。但是,在团队中工作时删除迁移文件是否有任何重大影响?相对于删除它,保留迁移文件是否有任何好处?对于我的情况,什么最有意义?我原来有一个迁移文件20140731141350_create_users.rb。
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :email
t.string :password
t.timestamps
end
end
end
我需要添加一个salt列,所以我创建了迁移20140804125449_add_salt_colum_to_users.rb
class AddSaltColumToUsers < ActiveRecord::Migration
def change
add_column :users, :salt, :string
end
end
在开发过程中,我意识到salt列是不必要的,并进行了修改。
rake db:migrate:down VERSION=20140731141350
现在我有一个未使用的20140804125449_add_salt_colum_to_users.rb迁移文件。
是要删除还是保留?