我试图回滚上次迁移:
rake db:rollback
它向我展示了以下内容:
== 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) ===================================
这里有什么问题?我应该在运行命令之前删除迁移文件吗?