On Thu, Jan 7, 2016, at 19:12, Carl Meyer wrote: > On 01/07/2016 03:03 PM, Aymeric Augustin wrote: > > As far as I understand, the CPU cost comes from generating a full set of > > model classes for each step of the migration history. That’s consistent > > with the profile sent by Florian. > > > > I usually end up throwing away the migration history and regenerating a > > new set of migrations when I get to that point. This requires truncating > > the django_migrations table manually and faking the new set of migrations. > > > > If the project doesn’t use data migrations, squashmigrations may achieve > > the same effect. Sadly real-life projects tend to have data migrations > > whose only purpose is to run once in production. They prevent full > > squashing. > > FWIW, I've also done a hybrid of these two options, where I generate > fresh initial migrations rather than actually using squashmigrations > (for the same reason, to avoid problems with data migrations), but then > I still keep the old migrations around for a transition period and use > the `replaces` attribute (the same one added automatically by > `squashmigrations`) on the new initial migrations. Then later (once the > new migrations are deployed everywhere) delete the old migrations and > the `replaces` attr. > > Effectively this is similar to what you're doing, it just takes > advantage of the `replaces` feature to avoid manually fiddling with the > migrations table on each deployment. > > If I (or anyone else) ever gets around to it, I think > https://code.djangoproject.com/ticket/24109 could make the actual > squashmigrations command usable for real projects, by letting you just > mark certain migrations as "please ignore when squashing". > > Carl >
I do the exact same thing (it's been kind of "manually squashing migrations" for me). I'm wondering if a PR with a new command to do this would be accepted (resetmigrations?) In my case, once data migrations have run in staging/production, they're useless and can be ignored forever, so there's no point in keeping them in later squashed migrations months later. -- Hugo Osvaldo Barrera -- 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 [email protected]. To post to this group, send email to [email protected]. 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/1452308171.2953982.487085330.71C83DEE%40webmail.messagingengine.com. For more options, visit https://groups.google.com/d/optout.
