Add global registration of custom migrations.

Review Request #12268 — Created May 5, 2022 and submitted — Latest diff uploaded

Information

Django Evolution
release-2.x

Reviewers

Custom migrations are used mainly in unit test suites to dynamically
construct migrations that can be applied to an app. Currently,
EvolveAppTask accepts these and passes them to MigrationExecutor.
However, upcoming work will involve creating a MigrationExecutor
outside of the management of EvolveAppTask, but with the need to use
the migrations registered there.

Now, EvolveAppTask registers custom migrations globally when preparing
tasks, and then urnegisters them after tasks have been prepared.

This is not thread-safe, but then, evolving the database is not
something that should ever be done by more than one thread (or process,
or server) at a time anyway. Plus this is really intended for unit
testing. So it's not a concern for this purpose.

All unit tests pass.

Tested along with upcoming work for a MoveToDjangoEvolution mutation.

Commits

Files