gpt4 book ai didi

ruby-on-rails - 清除旧的 Rails 迁移文件是个好主意吗?

转载 作者:数据小太阳 更新时间:2023-10-29 06:26:55 26 4
gpt4 key购买 nike

我已经运行一个大型 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 a db/archived_migrations folder or something like that. Once you do trim the size of your migrations folder, use the rake db:reset task to (re-)create your database from db/schema.rb and load the seeds into your current environment.

关于ruby-on-rails - 清除旧的 Rails 迁移文件是个好主意吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4248682/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com