Add new classes for managing signatures.
Review Request #9602 - Created Feb. 8, 2018 and updated
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.