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 doin
Sometimes I found myself deleting the migration file and then deleting the corresponding entry on the table schema_migrations from the database. Not pretty but it works.
Look at 4.1 Rolling Back
http://guides.rubyonrails.org/migrations.html
$ rake db:rollback
I just had this same problem:
That fixed it for me
I usually:
rake db:migrate VERSION=XXX
on all environments, to the version before the one I want to delete.rake db:migrate
again.If your application is already on production or staging, it's safer to just write another migration that destroys your table or columns.
Another great reference for migrations is: http://guides.rubyonrails.org/migrations.html
Side Note:
Starting at rails 5.0.0
rake
has been changed to rails
So perform the following
rails db:migrate VERSION=0
We can use,
$ rails d migration table_name
Which will delete the migration.