在Rails中清理迁移的好方法是什么? [英] What's a good way to clean up my migrations in Rails?

查看:67
本文介绍了在Rails中清理迁移的好方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我已经在这个Web应用程序上工作了一年了,我想将架构编译为一个迁移,这样我的文本编辑器加载速度更快,git工作目录也不会那么混乱。

So I've been working on this web app for a year now and I would like to compile to schema into ONE migration, that way my text editor loads faster, git working directory isn't so cluttered.

搜索发现会更快。

任何我的config / db的长度都不会超过4000px。

Any my config/db won't be 4000px long.

推荐答案

一种方法是获取空白数据库并运行所有迁移。现在,您已经拥有了所有模板数据,可以将其保存到Yaml中。 yaml加上架构应该足以在不运行任何先前存在的迁移的情况下将数据库带回。

One way to go is to take a blank database and run all the migrations. Now you've got all the template data which you can save to a yaml. The yaml plus the schema should be enough to bring the DB back without running any of your previously existing migrations.

但是,其他答案应该提及现有的工具或gem这个。

However, other answers should mention an existing tool or gem for doing this.

这篇关于在Rails中清理迁移的好方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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