[rails] Deleted NOFILE migration file

Case details

I got a file like this You can't bring down the migration file because you can't rollback

up     20200926110535  ********** NO FILE **********

How the incident happened

Probably with the migration status UP I have deleted the migration file.

In my case, I deleted the entire change on the git desktop, so it seems that this incident happened.

solution

Well, as a result of seeing some of the articles posted by everyone, it was solved safely.

First, to give a name to no faile Run this command in the terminal: zap: (Change the migration ID to your nofile ID. The name after that is a dummy, so anything is fine. )

% touch db/migrate/20200926110535_fuwafuwa.rb

After execution ↓

20200926110535_fuwafuwa.rb


class Hoge < ActiveRecord::Migration[5.2]
  def change
  end
end

Then the above name migration file will It should exist.

Please specify your rails version as the version !!!!!: shamrock:

After that, if you check rails db: migrate: status and it looks like this, it is successful.

up     20200926110535  fuwafuwa

After that, if you delete the migration file earlier, it will be solved safely! : corn:

Recommended Posts

[rails] Deleted NOFILE migration file
[Rails] Delete the migration file
Rails migration
Migration file to add comment to Rails table
Rails "How to delete NO FILE migration files"
[Rails] About migration files
[Rails] Migration command summary
Various rails migration operations
Understand migration in rails
Cancel Ruby on Rails migration
Database command for migration file environment
Minimal Rails with reduced file generation
Check the migration status of rails
[Rails] Modify migrate file (rails db: rollback)