我试图回滚最后一次迁移:
rake db:rollback
IT向我展示了以下内容:
== AddUserIdToPictures: reverting ============================================
-- remove_index(:pictures, {:column=>[:user_id, :visible]})
-> 0.1201s
-- remove_column(:pictures, :user_id, :integer)
-> 0.0127s
== AddUserIdToPictures: reverted (0.1567s) ===================================
然后,如果我尝试访问某个页面,就会出现错误:
Migrations are pending; run 'rake db:migrate RAILS_ENV=development' to resolve this issue
但当我执行错误提示的操作:rake db:migrate RAILS_ENV=development时,它重新创建了我之前回滚的内容。
== AddUserIdToPictures: migrating ============================================
-- add_column(:pictures, :user_id, :integer)
-> 0.0300s
-- add_index(:pictures, [:user_id, :visible])
-> 0.1007s
== AddUserIdToPictures: migrated (0.1310s) ===================================
这里有什么问题吗?我在运行命令之前应该删除迁移文件吗?