Add support for creating tables from models in EvolveAppTask.
Review Request #10567 — Created May 30, 2019 and submitted — Latest diff uploaded
EvolveAppTask
now has the capability to install models in the
database, creating all the necessary tables for the models and any
related models (such as for many-to-many relations).It does this by first checking whether we're evolving an app for the
first time, or whether we're adding a model for an existing app for the
first time. These models, and the SQL needed to install them, are
gathered during the preparation stage. All new models across all apps
are then installed duringEvolveAppTask.execute_tasks
, before
performing any evolutions for any apps.
EvolveAppTask.execute
can also take acreate_models_now
boolean
parameter, which will force installation of models immediately. This
will be needed for the initial installation of the Django Evolution
models in an upcoming change.
Unit tests pass for SQLite, MySQL, and Postgres on Django 1.6 and 1.11.