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

后端 未结 4 1530
梦如初夏
梦如初夏 2021-02-04 09:30

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

4条回答
  •  被撕碎了的回忆
    2021-02-04 09:52

    Given that none of the answers mention it, this is the gem that does the job: https://github.com/jalkoby/squasher

    It basically reruns the migrations from scratch until the date you specify, and then loads the resulting db/schema.rb into an initial migration that replaces the old ones. It can also cleanup the schema_migrations table so you don't get those

    up       ********** NO FILE **********
    

    entries when running rake db:migrate:status.

提交回复
热议问题