我应该扁平化Rails迁移吗? [英] Should I flatten Rails migrations?

查看:108
本文介绍了我应该扁平化Rails迁移吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以用db/schema.rb的内容替换db/migrate/*,这样您只需要执行一个迁移步骤即可.

It's possible to replace db/migrate/* with the contents of db/schema.rb, so that you only have one migration step.

你们有没有这样做?为什么?

Do any of you ever do this? Why?

推荐答案

为什么要这样做?如果您不想运行所有迁移,则可以只运行rake db:schema:load.迁移不(仅)用于初始化新数据库,而是用于将其迁移到另一个版本.

Why would you want to do this? You could just run rake db:schema:load if you don't want to run all migrations. Migrations are used not (only) to initialize a new database, but to migrate it to another version.

这篇关于我应该扁平化Rails迁移吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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