Don't attempt to apply mutations to newly-added models.

Review Request #11887 — Created Dec. 16, 2021 and submitted — Latest diff uploaded

chipx86
Django Evolution
release-2.x
django-evolution

When calculating the mutations that are relevant to a model, any models
found in the new signature are compared to the old signature, and if
their signatures match, the model is discarded from the list of models
that mutations may apply to.

This assumed if the model wasn't present in the old signature, it would
be considered changed. It also assumed that any new models would have a
baseline present in the signature. That was a valid assumption back when
evolution was somewhat driven by syncdb/migrate signals, but Evolver
changes that a bit. It's now possible for a model to not be in the old
signature at the time this computation is occurring.

Models not present in the old signature are now skipped, with the
assumption being that the baseline with all evolutions will be installed
in a later step. This prevents evolutions from incorrectly applying
immediately after a model is installed.

Unit tests pass on all supported versions of Django and Python.

Tested with a customer in production that was hitting an issue when
upgrading from a very old release of Review Board.

Commits

Files

Loading...