由于一些部署问题,我停止在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!它可以再生吗?
发布评论