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

Daniel Axtens dja at axtens.net
Mon Jul 19 11:54:48 AEST 2021


Stewart Smith <stewart at flamingspork.com> writes:

> 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. 

Oh that's handy to know, I'll see if I can use that to simplify some of
the series.

Arguably Django should use it but I'm definitely not going to try to
monkey-patch that in!

Kind regards,
Daniel


More information about the Patchwork mailing list