丢失了我的schema.rb!它可以再生吗? [英] Lost my schema.rb! Can it be regenerated?

查看:139
本文介绍了丢失了我的schema.rb!它可以再生吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于一些部署问题,我停止在git中跟踪schema.rb。不知何故,我已经把它塞满了,并且一直沿着我的schema.rb文件消失。

有没有一种方法可以从数据库或迁移中重新生成schema.rb ?如果您运行 rake -T

code>它会列出Rails项目的所有可能的rake任务。其中之一是 db:schema:dump ,它将从数据库中重新创建Rails应用程序的schema.rb。

  bundle exec rake db:schema:dump 


Due to some deployment issues I stopped tracking schema.rb in git. Somehow I have stuffed this up and somewhere along the way my schema.rb file has disappeared.

Is there a way of regenerating schema.rb from the database or from the migrations? I would prefer not to lose the existing data.

解决方案

If you run a rake -T it will list all possible rake tasks for your Rails project. One of them is db:schema:dump which will recreate the schema.rb for the Rails app from the database.

bundle exec rake db:schema:dump

这篇关于丢失了我的schema.rb!它可以再生吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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