Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我回滚了几步,一切正常,但现在我不能只使用 rake db:migration 命令来运行我的新迁移,它会再次运行所有恢复的迁移而不是最近的迁移,所以我必须运行最新的迁移通过其特定版本,这根本不方便。我该如何解决?
只需在迁移中注释代码或在不再需要时将其删除
您的数据库中应该有一个名为“schema_migrations”的表。对于不再需要运行的每个迁移,Rails 都会在此表中添加一个条目。同样,Rails 在恢复迁移时会从该表中删除相关条目。
您可以手动添加您不想再运行的迁移的条目。