Add new classes for managing signatures.
Review Request #9602 — Created Feb. 8, 2018 and submitted
This introduces a series of new classes for managing the state of
signatures. Signatures are what's stored every time a database evolution
is performed. They track the state of all the applications, models,
fields, etc. in the database, and are used to simulate operations and
compute differences. Previously, this was all managed by plain
dictionaries, which meant that the signature's format could never
structurally evolve (which will be necessary in the future), and these
new classes are designed to help address that.The signature classes cover the main project signature, application
signatures, model signatures, field signatures, Django 1.11+ index
signatures. They feature the ability to create instances from their
respective instance types and from serialized data, and have the ability
to serialize back out.Right now, these are actually very short-lived. They're built from other
state (stored state or in-process state) and are then serialized back to
a dictionary for all the evolution operations. Future changes will move
over to interfacing with the new signature classes directly, only
serializing when it's time to write out the state.
Unit tests pass for all databases and Django versions. Tested with
Python 2.7 and 3.6.
Description | From | Last Updated |
---|---|---|
F401 'django.db.router' imported but unused |
reviewbot |
- Change Summary:
-
- Updated for some of the latest changes on master.
- Moved
related_model
to a standard attribute in the signature. - Added missing calls to
ProjectSignature.from_database
.
- Commit:
-
88c2ba7c30a594c2e7f6fe3dcf97709465bb7d33a048a4bba650cf9bab53b99e6873f13e85b3008f