When enabling an extension, we go through a series of steps to ensure
its state is made available both in the database and to the running
application. Part of this involves synchronizing models to the database
and performing evolutions. However, given that this process is a bit
time-consuming and invasive, it's not something we want to run if we
don't have to. Synchronizing and evolving the database isn't a selective
operation -- it applies to all models across all apps -- so we want to
avoid it when possible.
This change makes the process a lot smarter. Now, before attempting to
sync the database, the extension manager will look at the list of apps
provided by the extension and check if any of them provide models. If
so, then the database will be synced. It then looks to see if there are
any unapplied evolutions for the extension before attempting to evolve
the database.
If these operations are not required, they will no longer be performed.
There's still room for future improvement, but they involve much more
careful introspection of the models and the database, and upstream
changes for Django Evolution to allow for selective evolution.