Merge all migation files

54 views
Skip to first unread message

Manish Shrivastava

unread,
May 27, 2015, 7:58:24 PM5/27/15
to rubyonra...@googlegroups.com
Hi, My One of Rails Project started 2 years ago. Today I see there are many changes on database. Many Tables/ and table fields got added and many were removed as well. If I see my db/migration folder It has almost 200 files.

I wish to suggest a feature where by running a command like `rake db:migrate:files` could merge all files into table-wise. like if 20 tables are there It make new 20 migration cleaner way.

Please suggest!


Maurício Linhares

unread,
May 27, 2015, 8:03:22 PM5/27/15
to rubyonra...@googlegroups.com
This is what your schema.rb file is for.

-
Maurício Linhares
http://mauricio.github.io/ - http://twitter.com/#!/mauriciojr
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-co...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> Visit this group at http://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.

Arthur Neves

unread,
May 28, 2015, 7:42:44 AM5/28/15
to rubyonra...@googlegroups.com
The schema.rb file it is indeed for this. 
One thing we do at Shopify, is we have a `db:migrate:rollup` task, that delete the files older than 3 months that are on the schema.rb already. So we dont keep a huge folder of migrations.
Not sure if that's everyones use case tho.

Radan Skoric

unread,
May 28, 2015, 9:18:51 AM5/28/15
to rubyonra...@googlegroups.com
At Toptal we do a similar thing, we periodically clean up old migrations with https://github.com/jalkoby/squasher. We delete all old ones and update one "initial migration".
Reply all
Reply to author
Forward
0 new messages