How to delete migration files in Rails 3

2019-01-16 01:06发布

I would like to remove/delete a migration file. How would I go about doing that? I know there are similar questions on here but as an update, is there a better way than doing script/destroy?

Also, should I do a db:reset or db:drop if I remove/delete a migration?

8条回答
Animai°情兽
2楼-- · 2019-01-16 01:57

Look at 4.1 Rolling Back

http://guides.rubyonrails.org/migrations.html

$ rake db:rollback

查看更多
男人必须洒脱
3楼-- · 2019-01-16 01:58

I just had this same problem:

  1. rails d migration fuu -this deleted the migration with the last timestamp
  2. rails d migration fuu -this deleted the other migration
  3. use git status to check that is not on the untracked files anymore
  4. rails g migration fuu

That fixed it for me

查看更多
登录 后发表回答