从 schema.rb 生成迁移文件

编程入门 行业动态 更新时间:2024-10-12 05:51:17
本文介绍了从 schema.rb 生成迁移文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我希望从 schema.rb 生成一个迁移文件.是否可以?

I'm looking to generate a migration file from the schema.rb. is it possible?

我目前有许多迁移文件,并希望将所有内容合并到一个主迁移文件中.

I have many migration files at the moment and would like to combine everything into one master migration file.

我还认为我可能在某些时候不小心删除了迁移文件.

I also think i may have accidentally deleted a migration file at some point.

感谢您的帮助

推荐答案

没必要这么做.对于新安装,您应该运行 rake db:schema:load,而不是 rake db:migrate,这会将模式加载到数据库中,这比运行所有迁移.

There's no need to do this. For new installations you should be running rake db:schema:load, not rake db:migrate, this will load the schema into the database, which is faster than running all the migrations.

您不应该删除迁移,当然也不应该合并它们.至于误删,你应该使用版本控制系统,比如Git.

You should never delete migrations, and certainly not combine them. As for accidentally deleting one, you should be using a version control system, such as Git.

更多推荐

从 schema.rb 生成迁移文件

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

发布评论

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

>www.elefans.com

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