如何保持数据从开发到生产的转移 DB:Rails3 应用程序
男孩们,女孩们
,我已经完成了我的 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以前,我使用 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