What might be interesting to look into when squashing all migrations in one app would be to assume no migrations would exist. That could then result in only 2 migrations which could run through the optimizer (as opposed to let's say 20 migrations with many more operations).
/Markus On Wednesday, February 15, 2017 at 3:46:01 PM UTC+1, Florian Apolloner wrote: > > Fwiw I think by default it could/should try to optimize all migrations of > an app, manually specifying the migration name should be optional. > > On Wednesday, February 15, 2017 at 2:00:54 PM UTC+1, rap...@makeleaps.com > wrote: >> >> I ended up having some time today, so wrote up a management command for >> the first suggestion! >> >> I called it "optizemigration" >> >> >> >>> ./manage.py optimizemigration appname 0001_squashed >> # snipped django startup noise >> Optimized from 9 operations to 4 operations >> >> Optimized migration /Users/rtpg/proj/projname/projname/appname/migrations >> /0001_squashed_20170215.py >> >> >> This reads in the migration file, runs the migration optimizer, and then >> outputs to the same file. Writing it has paid off almost immediately for me. >> >> Those who are interested can take a look here >> <https://github.com/rtpg/django/blob/optimizemigration/django/core/management/commands/optimizemigration.py> >> . >> >> How much testing/coverage requirements are there for management commands >> like these? >> >> >> -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/24896164-cf2f-4eb9-8d87-3932f2c30e78%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.