Introduce version 2 of the Django Evolution signature format.
Review Request #10545 — Created April 30, 2019 and submitted — Latest diff uploaded
The old version 1 signature format was built to be somewhat compact,
with a project signature mixing version information and app signatures,
an app signature consisting solely of its models, and a field's signature
mixing the field type (which was a class reference), a possible related
model, and field attributes. The whole thing was serialized to the
pickle v0 format, which isn't the most easy-to-debug or most-portable
format out there.
The new version 2 signature format provides a bit more organization.
Now, a project keeps its app signatures inside of an "apps" entry. App
signatures keep its models under a "models" entry. Field signatures keep
its attributes under "attrs", and provide a string-based class name for
the field instead of a class reference (making it easier to fix entries
if fields move around). It's serialized to JSON, which is easier to
inspect and is far more future-proof.
The change is entirely transparent to the rest of Django Evolution, now
that we use the signature classes everywhere. Versions are only factored
in during serialization/deserialization.
Going forward, all signatures written to the database will be
JSON-encoded v2 signatures. This means that databases utilizing the
upcoming version of Django Evolution will not be compatible with older
versions of Django Evolution.
Unit tests pass on Python 2.7/Django 1.6 and Python 3.7/Django 1.11.