Fix SQLite 3.25 and earlier on Django 1.6.
Review Request #11118 — Created Aug. 4, 2020 and submitted
A recent change introduced an elaborate form of schema rewriting for
SQLite databases that works around issues in renaming primary keys that
have references pointed toward them. SQLite 3.26 had a sane solution for
this, but earlier versions required the workaround.
The testing performed at that time had a flaw. The Django 1.6
environment was running SQLite 3.26, and while the other environments
were a mix of 3.24 and 3.26, it turns out that there was one key
difference separating Django 1.6 and newer versions: Django didn't
bother to create references from the M2M intermediary table to the
This prevented the schema rewriting logic from kicking in (and also
masked an issue with a return type difference from Django 1.7 and 1.8+'s
Both these issues are now fixed. The return type is checked for, and the
SQLite test queries have been updated to expect the appropriate
variations on Django 1.6.
Unit tests pass for SQLite on all versions of Django and Python.
Tested Django 1.6 with SQLite 3.24 and 3.26.