【发布时间】:2014-08-04 23:23:06
【问题描述】:
我对 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 迁移文件。
删除还是不删除?
【问题讨论】:
-
如果不需要,删除它。
标签: ruby-on-rails ruby rails-migrations