Is it a good idea to purge old Rails migration files?

前端 未结 10 1648
清歌不尽
清歌不尽 2021-01-01 11:16

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

10条回答
  •  温柔的废话
    2021-01-01 12:07

    The Rails 4 Way page 177: Sebastian says...

    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.

提交回复
热议问题