我已经运行一个大型 Rails 应用程序 2 年多了,一天天过去,我的 ActiveRecord 迁移文件夹已经增长到超过 150 个文件。
有一些非常旧的模型,在应用程序中不再可用,但仍会在迁移中引用。我想删除它们。
你怎么看?您通常会从代码库中清除旧的迁移吗?
最佳答案
The Rails 4 Way第 177 页: 塞巴斯蒂安说……
A little-known fact is that you can remove old migration files (while still keeping newer ones) to keep the
db/migrate
folder to a manageable size. You can move the older migrations to adb/archived_migrations
folder or something like that. Once you do trim the size of your migrations folder, use therake db:reset
task to (re-)create your database fromdb/schema.rb
and load the seeds into your current environment.
关于ruby-on-rails - 清除旧的 Rails 迁移文件是个好主意吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4248682/