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

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

问题描述

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.

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 ;)

Check out these guidelines:

http://guides.rubyonrails.org/migrations.html#using-models-in-your-migrations

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

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