它是清除旧的Rails迁移文件是个好主意? [英] Is it a good idea to purge old Rails migration files?

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

问题描述

我已经运行一天一个很大的Rails应用程序超过2年,一天,我的ActiveRecord迁移的文件夹已经成长为超过150个文件。

I have been running a big Rails application for over 2 years and, day by day, my ActiveRecord migration folder has been growing up to over 150 files.

有很老的机型,不再在应用程序中,在迁移仍引用。我想将其删除。

There are very old models, no longer available in the application, still referenced in the migrations. I was thinking to remove them.

你怎么看?你平时清除旧的迁移从codeBase的?

What do you think? Do you usually purge old migrations from your codebase?

推荐答案

他们都比较小,所以我会选择让他们,只是备案。

They are relatively small, so I would choose to keep them, just for the record.

您应该写你没有迁移参考模型,或应用程序的其他部分,因为他们会回来给你难以忘怀;)

You should write your migrations without referencing models, or other parts of application, because they'll come back to you haunting ;)

查阅这些指导原则:

http://guides.rubyonrails.org/migrations。 HTML#使用-模式 - 在你的迁移

这篇关于它是清除旧的Rails迁移文件是个好主意?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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