Defer constraints and indexes when creating models through the evolver.
Review Request #12282 — Created May 15, 2022 and submitted
When generating SQL for new models,
EvolveAppTaskwas 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
All unit tests pass for all databases.
Verified this fixed a messy upgrade issue with Review Board 4 -> 5.
Fixed a unit test on MySQL.
Revision 2 (+240 -52)