如何在 rails 3.1.3 中安全地更新生产数据库架构? [英] How to update production database schema safely in 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屋!