丢失了我的schema.rb!它可以再生吗?

编程入门 行业动态 更新时间:2024-10-13 08:18:34
本文介绍了丢失了我的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!它可以再生吗?

本文发布于:2023-10-18 04:28:34,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:它可以   丢失了   schema   rb

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!