Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 4 Remove Migration ID from Migration Index

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.

like image 694
Jay Avatar asked Dec 20 '13 22:12

Jay


2 Answers

You need to delete that numbers from your schema_migrations table in the database.

like image 132
spickermann Avatar answered Nov 14 '22 08:11

spickermann


You deleted the file but the ID is still in the schema table.

Just Log into mysql

 SELECT * FROM schema_migrations; *- take note of the version_id*

Then

DELETE FROM schema_migrations WHERE VERSION = version_id; 

Then logout and verify

rake db:migrate:status
like image 25
Davegon Avatar answered Nov 14 '22 09:11

Davegon