I did multiple minor migrations.
Is it possible to squash these migrations into one?
There's no automatic way to do it, but it's pretty straightforward to do it manually. For illustration, you have the following migrations A through E and all migrations are applied to the database (current is E). You want to squash C through E.
A > B > C > D > E
upgrade
and downgrade
functions from C and D into E. Maintain the order of operations, and remove redundant operations (in your example you'd actually just end up with the contents of E).down_revision
of E to point to B instead of D.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With