简体   繁体   English

Heroku - 如何删除表并再次运行迁移?

[英]Heroku - how to remove table and run migration again?

I just discovered that one of my tables in Heroku app has a different structure than the one on my localhost. 我刚刚发现Heroku应用程序中的一个表与我本地主机上的表结构不同。

In the best way I would need to run the migration that create a new table again, but what is the best way to do that? 在最好的方式中,我需要运行再次创建新表的迁移,但最好的方法是什么?

Just simply manually remove the table in Heroku terminal and then change the date of migration and run it again? 只需手动删除Heroku终端中的表,然后更改迁移日期并再次运行它?

you can redo a single migration file like this: 你可以像这样重做一个迁移文件:

heroku run rake db:migrate:redo VERSION=20130311054546

where 20130311054546 is the timestamp of your migration. 其中20130311054546是您的迁移的时间戳。

To do different database modifications, such as drop table etc., I usually use David Dollar's heroku SQL console 要进行不同的数据库修改,例如drop table等,我通常使用David Dollar的heroku SQL控制台

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM