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
Personally I like to keep things tidy in the migrations files. I think once you have pushed all your changes into prod you should really look at archiving the migrations. The only difficulty I have faced with this is that when Travis runs it runs a db:migrate
, so these are the steps I have used:
Move historic migrations from /db/migrate/
to /db/archive/release-x.y/
Create a new migration file manually using the version number from the last run migration in the /db/archive/release-x.y
directory and change the description to something like from_previous_version
. Using the old version number means that it won't run on your prod machine and mess up.
Copy the schema.rb
contents from inside the ActiveRecord::Schema.define(version: 20141010044951) do
section and paste into the change
method of your from_previous_version
changelog
Check all that in and Robert should be your parent's brother.
The only other consideration would be if your migrations create any data (my test scenarios contain all their own data so I don't have this issue)