Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

A command to optimize a squashed migration?

136 views
Skip to first unread message

Shai Berger

unread,
Oct 31, 2016, 9:58:25 AM10/31/16
to django-d...@googlegroups.com
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

Andrew Godwin

unread,
Oct 31, 2016, 11:40:34 AM10/31/16
to Django developers (Contributions to Django itself)
I would say that a command to re-optimise a single migration would be a good idea, especially since it needs no changes to the stored set of run migrations since it would theoretically do the same thing.

Andrew


--
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+unsubscribe@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/201610311558.10025.shai%40platonix.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages