Rails 3 删除的迁移文件不断返回
我有相同迁移的两个版本(我知道这是坏习惯)。我多次删除旧版本,但是在重新启动我的项目(或对其执行某些操作,例如 rake db:test:prepare)后,该文件显示在我的迁移文件夹中。当我运行 rake db:migrate 时,它会抱怨同名的多个迁移。
如何彻底删除迁移文件?是否有需要删除的注册表以防止其再次出现?
I have 2 versions of the same migration (bad habit, I know). I deleted old version many times, but after restarting my project (or do something with it, like rake db:test:prepare), the file shows up in my migrate folder. When I run rake db:migrate, it will complain about multiple migrations with the same name.
How can I delete a migration file completely? Is there a registry that I need to remove to prevent it from coming back?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是从存储库更新吗?我不知道如何才能恢复原始文件。
您还可以从 schema_migration 表中删除该条目,但这只是跟踪它是否已运行(IIRC)。
Are you updating from a repo? I don't see how the original file could be restored otherwise.
You can also delete the entry from the schema_migration table, but that just tracks if it's been run or not (IIRC).
git add
仅添加新文件和更改的文件,不会删除已删除的文件。删除:或者如果您已经从文件系统中删除它:
git add
only adds new and changed files, it doesn't remove deleted ones. To delete:or if you have already deleted it from the filesystem: