Rails 4 Remove Migration ID from Migration Index

Viewed 4821

How do I remove a migration ID listing with "** NO FILE **" in rake db:migrate:status? For example:

 Status   Migration ID    Migration Name
--------------------------------------------------
   up     20131017204224  Create users
   up     20131218005823  ********** NO FILE **********
   up     20131218011334  ********** NO FILE **********

I'm not understanding why it would still keep an old migration file when I manually removed it myself as I was playing around with how migrations work. Is this for record keeping? But what use is it when I don't have a name associated with it?

I tried using db:migrate:down command for those files but it says file missing. I have no clue what to do here.

Can someone explain how to remove this listing and maybe some insight on why this might happen.

3 Answers

You can also delete it using SQL, but through the rails console.

sql = "DELETE FROM schema_migrations WHERE VERSION = 'version_id'"
ActiveRecord::Base.connection.exec_query(sql)
Related