我在开发和生产环境中使用了mysql Ver 14.14。我有一个db迁移文件,如:
class ChangeRoleToNodeTemplate < ActiveRecord::Migration
def up
rename_table :roles, :node_templates
end
def down
rename_table :node_templates, :roles
end
end
当我运行'rake db:migrate'命令时,它生成的schema.rb文件是正确的。
但是当我运行'rake db:migrate RAILS_ENV = production'时,它包含具有相同模式的'roles'和'node_templates'表。
任何人都可以给我一个建议吗?感谢。
我使用了Rails 3.1.0
答案 0 :(得分:1)
不确定为什么以及如何发生这种情况,但我会先尝试完全回滚生产数据库,而不仅仅是加载模式并检查
回滚生产db:
rake db:rollback RAILS_ENV=production STEP=100
加载架构:
rake db:schema:load RAILS_ENV=production