Update the SiteConfiguration and SCMTool setup after DB install/upgrade.
Review Request #10606 — Created June 21, 2019 and submitted — Latest diff uploaded
We create and manage a
SiteConfigurationand registerSCMToolswhen
syncing the database (which happens when creating a site, upgrading it,
or during some unit test runs, when not just rolling back transactions).
This is done by listening to asyncdboperation and hooking in at the
right moment.With Django 1.11, we need to react to
migrateevents instead. This
works in a similar way, and is run at similar times. This change adds
support for bothsyncdbandmigrate, while we're still in a
transition phase.Ideally, we'd move to performing this after an
evolveoperation, which
would ensure we only bump the database version in the siteconfig or
register tools when we're completely done with an installation or
upgrade. This is a Nice To Have, but not required. Doing this properly
would involve cleaning up how ourSCMToolsare registered during test
runs (we currently register via both fixtures and the management
command), and ensuring creation of aSiteConfigurationduring all test
runs. This is a clean-up task for the future.This change also nukes the old baseline evolution schema, which was
required back in pre-1.0 to help establish a base set of evolutions and
serialized model data so that unwanted changes aren't applied. We don't
need this at all anymore, and Django Evolution is smart enough to handle
more of those sorts of situations anyway. Removing this simplifies a
decent amount of our setup and startup.
Unit tests pass on Django 1.6 and 1.11.
Successfully created new databases and upgraded existing ones.