[PATCH 2/4] migrations: 0043_merge_patch_submission: do less work

Stewart Smith stewart at flamingspork.com
Sat Jul 17 04:35:48 AEST 2021


On Jul 16, 2021, at 10:20 AM, Daniel Axtens <dja at axtens.net> wrote:
> 
>  - we do a lot of legwork to prevent there being a column with the same
>   name in a base class and subclass. This is purely for django's benefit
>   as databases don't see the class relationship and handle column names
>   being the same across tables just fine. Unfortunately renaming columns
>   in MySQL/MariaDB is _extremely_ expensive. So just don't do it: lie to
>   django about the names of the duplicate columns.

I believe that modern versions can ALTER TABLE ONLINE to do a column rename without having to copy all the data. Should also work for adding columns (some types).

Arguably Django could probably switch to trying specifying ONLINE as the method and falling back to offline (full copy) if it can’t do it online. 


More information about the Patchwork mailing list