如何保持数据从开发到生产的转移 DB:Rails3 应用程序

发布于 2024-11-18 07:12:59 字数 272 浏览 3 评论 0原文

男孩们,女孩们

,我已经完成了我的 Rails3 web 应用程序,并且正在尝试部署它。我正在使用 Passenger,我已设法将其配置为指向 Rails 应用程序,这很好。

现在,在开发过程中,我当然对应用程序进行了更改,并且我想使用到目前为止导入的数据来部署它。我尝试“rake db:migrate RAILS_ENV=生产,但是数据丢失了!甚至我在开发时创建的用户也丢失了,需要再次创建它们......

有没有什么方法可以在从开发到生产环境?

非常感谢...

Boys and girls,

So, I have finished my Rails3 webapp and I am trying to deploy it. Am using Passenger, I have managed to configure it as to point to the rails app, that is fine.

Now, since in development i have made of course changes to the app and I want to deploy it with the data i have imported until now. I tried to "rake db:migrate RAILS_ENV=production, but the data are lost! Even the users I have created while developing are lost and need to create them again...

Isn't there any way to keep the data while moving from development to production environments?

Thank you very so much...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

久隐师 2024-11-25 07:12:59

以前,我使用 yaml_db gem 从一个环境数据库导出到另一个环境数据库,效果很好。

也就是说,运行迁移不应导致所有数据消失。您的数据库是被销毁然后重新创建还是实际上清空了表?另外,您如何使用 capistrano 将应用程序部署到生产环境?如果是这样,请检查是否没有在部署过程中运行不需要的额外任务

Previously I have used the yaml_db gem to do export from one environments db to another and it's worked great.

That said, running migrations shouldn't cause all your data to disappear. Is your db being destroyed and then re-created or is it actually emptying the tables? Also, how are you deploying the app to production - using capistrano? If so check that there are no unwanted extra tasks being run as part of the deployment

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文