Search code examples
ruby-on-railsactiverecordrails-activerecordrails-migrations

What's a good way to clean up my migrations in Rails?


So I've been working on this web app for a year now and I would like to compile to schema into ONE migration, that way my text editor loads faster, git working directory isn't so cluttered.

Search find will be faster.

Any my config/db won't be 4000px long.


Solution

  • One way to go is to take a blank database and run all the migrations. Now you've got all the template data which you can save to a yaml. The yaml plus the schema should be enough to bring the DB back without running any of your previously existing migrations.

    However, other answers should mention an existing tool or gem for doing this.