• 
      

    Batch together operations for a SQLite table rebuild.

    Review Request #11084 — Created July 16, 2020 and submitted — Latest diff uploaded

    Information

    Django Evolution
    master

    Reviewers

    A while back, Django Evolution introduced AlterTableSQLResult, which
    worked with the mutation optimizer to reduce the number of ALTER 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).

    Commits

    Files