从 schema.rb 生成迁移文件 [英] Generate a migration file from schema.rb

查看:13
本文介绍了从 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 生成迁移文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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