简体   繁体   English

可以从命令行强制迁移吗?

[英]Possible to force a migration from the command line?

I made a rookie mistake with a migration yesterday. 我昨天在迁移中犯了一个菜鸟错误。 I amended a migration that had already been uploaded and run, and I forgot to rollback before uploading the new version. 我修改了已经上传并运行的迁移,我忘记在上传新版本之前回滚。 Now, the migration is failing because either a column already exists (up) or there is no column to delete (down)! 现在,迁移失败了,因为列已经存在(向上)或者没有要删除的列(向下)!

Is it possible to get a migration to force its changes one time from the console, without having to write :force => true within the document first, migrating, and then removing it again? 是否有可能从控制台获取迁移以强制进行一次更改, 而不 :force => true在文档中写入:force => true ,迁移,然后再次删除它?

回到稳定状态的一种简单方法是在数据库中手动更改添加列以使回滚工作,然后执行回滚并再次向上迁移。

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

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