Defer constraints and indexes when creating models through the evolver.

Review Request #12282 — Created May 15, 2022 and submitted — Latest diff uploaded

Information

Django Evolution
release-2.x

Reviewers

When generating SQL for new models, EvolveAppTask was lumping together
the SQL for the model creation and for any constraints/indexes. This
could be fine a lot of the time, but depending on the complexity of the
upgrade, that deferred SQL could fail.

A sample scenario would be an app creating a model that has a reference
to an existing model, but to a newer Primary Key type that would be (but
hasn't yet been) evolved on the target model.

We now separately track the model creation SQL and the deferred SQL. All
deferred SQL is executed once all evolutions and migrations have
concluded.

All unit tests pass for all databases.

Verified this fixed a messy upgrade issue with Review Board 4 -> 5.

Commits

Files

    Loading...