• 
      

    Add global registration of custom migrations.

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

    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.

    Summary ID
    Add global registration of custom migrations.
    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.
    031da376469834a770cbf225c4479b729124be97
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-2.x (9f43d56)