从schema.rb生成迁移文件

编程入门 行业动态 更新时间:2024-10-12 12:28:56
本文介绍了从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:26:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1503100.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   schema   rb

发布评论

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

>www.elefans.com

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