开发者

deleted migration file keeps coming back Rails 3

开发者 https://www.devze.com 2023-04-09 16:26 出处:网络
I h开发者_开发技巧ave 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

I h开发者_开发技巧ave 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?


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 only adds new and changed files, it doesn't remove deleted ones. To delete:

git rm db/migrate/<filename>

or if you have already deleted it from the filesystem:

git add -u
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号