How do I remove a migration ID listing with "** NO FILE **" in rake db:migrate:status? For example:
如何在rake db:migrate:status中删除带有“** NO FILE **”的迁移ID列表?例如:
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.
我尝试对这些文件使用db:migrate:down命令,但它说文件丢失了。我不知道该怎么做。
Can someone explain how to remove this listing and maybe some insight on why this might happen.
有人可以解释如何删除此列表,也许可以了解为什么会发生这种情况。
3 个解决方案
#1
5
You need to delete that numbers from your schema_migrations
table in the database.
您需要从数据库中的schema_migrations表中删除这些数字。
#2
8
You deleted the file but the ID is still in the schema table.
您删除了该文件,但该ID仍在架构表中。
Just Log into mysql
只需登录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
#3
4
You can also delete it using SQL, but through the rails console.
您也可以使用SQL删除它,但是通过rails控制台。
sql = "DELETE FROM schema_migrations WHERE VERSION = 'version_id'"
ActiveRecord::Base.connection.exec_query(sql)
#1
5
You need to delete that numbers from your schema_migrations
table in the database.
您需要从数据库中的schema_migrations表中删除这些数字。
#2
8
You deleted the file but the ID is still in the schema table.
您删除了该文件,但该ID仍在架构表中。
Just Log into mysql
只需登录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
#3
4
You can also delete it using SQL, but through the rails console.
您也可以使用SQL删除它,但是通过rails控制台。
sql = "DELETE FROM schema_migrations WHERE VERSION = 'version_id'"
ActiveRecord::Base.connection.exec_query(sql)