﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
24109	Provide a way to mark a migration operation as elidable when squashing	Carl Meyer	Simon Charette	"The vast majority of my RunPython/RunSQL operations are data migrations related to an enclosing pair of schema migrations: for instance, add a new field, migrate data to it from an old field, then remove the old field. Such operations are generally safe to elide when squashing: in the squashed and optimized list of operations, old-field should never exist at all, and thus there is no need for a migration to move data from old-field to new-field. But the migration system doesn't know this, so it (correctly) refuses to optimize across the RunPython/RunSQL, causing schema-altering migrations to be preserved that shouldn't be (i.e. creation and removal of old-field won't be optimized away, because of the intervening RunPython/RunSQL).

It's possible to manually remove such RunPython/RunSQL operations before squashing, but it's a pain to review the whole history for such cases and manually remove them.

I would find it useful to have an attribute like `elidable` or `optimize_across` on migration operations (at least on `RunPython` and `RunSQL`), settable via a kwarg to the constructor, which would default to `False` (preserving the current behavior), but if set to `True` would mark the migration as ""safe to elide and optimize across"". This would never be set to `True` by the autodetector, it would only ever be set manually by the user.

Thoughts?"	New feature	closed	Migrations	dev	Normal	fixed		Marc Tamlyn ryan@…	Ready for checkin	1	0	0	0	0	0
