Capistrano回滚会撤消迁移吗? [英] Does a capistrano rollback undo migrations?

查看:80
本文介绍了Capistrano回滚会撤消迁移吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的。我有一个生产服务器,需要从github部署该应用程序的最新版本,所以我在使用Capistrano。

I'm new to this. I have a production server and need to deploy the latest version of the application from github, so I'm using Capistrano.

最新版本对数据库进行了一些更改,因此有很多迁移,因此我将使用deploy:migrate进行部署。

The newest release makes some changes to the database and hence has a bunch of migrations, so I'll be deploying it with deploy:migrate.

所以我的问题是,如果我将一些数据添加到创建的新列中(它不更改表中的任何现有列,仅创建新的表和列),然后要回滚,然后将capdeploy:rollback也逆转所有迁移吗?是否会擦除这些新列中的数据并将数据库恢复到以前的状态(假设除了对db中的新添加内容外,我没有进行任何数据更改)?

So my question was, if I add some data to the new columns created (it doesn't change any of the existing columns in the tables, just creates new tables and columns) and then want to rollback, then will cap deploy:rollback reverse all the migrations as well? Is the data in those new columns erased and the database back to the previous state (assuming I didn't make any data change except to the new additions in the db)?

谢谢!

推荐答案

不,不会。您需要通过rake手动运行这些迁移的失败部分,然后回滚。

No, it will not. You would need to manually run the down part of those migrations via rake and then roll back.

但是,如果您当前的应用不会受到新行的影响,不会伤害任何东西。

However, if your current app won't be affected by the new rows it won't hurt anything.

这篇关于Capistrano回滚会撤消迁移吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆