如何在 rails 3.1.3 中安全地更新生产数据库架构? [英] How to update production database schema safely in rails 3.1.3?

查看:40
本文介绍了如何在 rails 3.1.3 中安全地更新生产数据库架构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们需要在生产环境中为 rails 3.1.3 应用程序不断更新我们的数据库架构.第一个数据库架构是使用以下 rails 命令创建的:

We need constantly update our database schema in production for rails 3.1.3 app. The first db schema was created with the following rails command:

$rake RAILS_ENV=production db:schema:load

问题是:我们是否仍然可以使用上面的命令在生产中更新数据库架构,同时安全地保留所有当前数据?

Question is: can we still use the command above to update db schema in production while safely retaining all current data?

非常感谢.

推荐答案

我从未在生产中使用 rake db:schema:load,但根据 这个答案 到这里的另一个问题,我认为你不想这样做.

I never used rake db:schema:load in production, but according to this answer to another question here on SO, I don't think you want to do that.

另一方面,我在服务器上多次使用 RAILS_ENV=production rake db:migrate 数据已经在数据库中,并且从未遇到任何问题.

On the other hand, I have used RAILS_ENV=production rake db:migrate several times on the server with data already in the database and never experienced any problems.

这篇关于如何在 rails 3.1.3 中安全地更新生产数据库架构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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