Hi,
I'm doing some migration squashing, which was long overdue; so, I'm squashing
dozens of migrations at once. Within these migrations, there are data
migrations (RunPython operations) which, of course, stand as barriers to
optimization. The operations have not been defined elidable -- because we are
still on Django 1.8. So, after squashing, I go over the operations one by one,
find that they are indeed elidable, and delete them. Which leaves me with a
sub-optimized squashed migration.
This got me thinking, though, about our solution to the situation in general:
If I were on Django 1.10, I could probably solve my problem by changing the
original operations to elidable, and then running squashmigration again. But
does this solve all cases? Wouldn't we like a way to take a hand-edited
migration, squashed or otherwise, and optimize it?
For the record, the optimizing command was suggested, under the name
"resquash", by Piotr Maliński[1]. The suggestion didn't really get a lot of
traction, and as mentioned, the "elidable" flag solves a big part of the
problem, if not all of it.
Thoughts?
Thanks,
Shai.
[1]
https://groups.google.com/d/msg/django-developers/vtf-4II-rEo/OIA1Sdsnm6oJ