Batch together operations for a SQLite table rebuild.
Review Request #11084 — Created July 16, 2020 and submitted
A while back, Django Evolution introduced
AlterTableSQLResult
, which
worked with the mutation optimizer to reduce the number ofALTER TABLE
statements required for traditional databases when applying several
evolutions at once. That didn't work with SQLite, though, since SQLite
required a full table rebuild to make most changes.This change enables these optimized operations through a new
SQLiteAlterTableSQLResult
, which is a specialization of
AlterTableSQLResult
that supports its own internal operations for
adding/deleting/renaming/changing columns, setting up state that's used
to construct the destination table when rebuilding.That reduces the number of table rebuilds significantly, making it less
likely that something can go wrong and speeding up a chain of
evolutions.
Unit tests passed on all supported versions of Django, all databases,
and with SQLite 3.24.0 and 3.28.0 (which both handle table alterations
in subtly different ways).
Summary | ID |
---|---|
06d4f831015a3e766080d0c641bb1f372fd464fa |
Description | From | Last Updated |
---|---|---|
F401 'django_evolution.db.common.SQLResult' imported but unused |
reviewbot | |
F841 local variable 'database_state' is assigned to but never used |
reviewbot | |
F812 list comprehension redefines 'field' from line 87 |
reviewbot | |
F841 local variable 'create_indexes' is assigned to but never used |
reviewbot |
- Change Summary:
-
- Removed unused imports and variables.
- Renamed some variables in a list comprehension to avoid a warning about reused variables.
- Commits:
-
Summary ID e91775aa836ef7b321f548656b7870b66bbd167a 06d4f831015a3e766080d0c641bb1f372fd464fa