rails db:migrate:status
NO FILE means that the migration file should have been deleted but remains on the computer. I feel uncomfortable, so I'll erase it.
rails db:rollback
--This will change the status part from up to down. (It can be edited) --Restore this empty file with a name
touch db/migrate/20200929050736_hoge.rb
This will restore a migration file called hoge. However, nothing is written in this file, so describe it appropriately. Add the following sentence in its entirety
class Hoge < ActiveRecord::Migration[6.0]
def change
end
end
rails db:migrate
rails db:rollback
It became down. Command to erase here
rm -rf db/migrate/20200929050736_Hoge.rb
Let's check again with rails db: migrate: status
Recommended Posts