#33903: Changing the related_name field causing pointless foreign key 
re-creations
on MySQL migrations
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  nobody
  ThomasAitken                       |
                   Type:  Bug        |         Status:  new
              Component:             |        Version:  2.2
  Migrations                         |       Keywords:  migrations,foreign
               Severity:  Normal     |  key
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 MySQL version = 8.0, Django version = 2.2.28. Each change to a
 related_name triggers a migration that looks like the following:
 ALTER TABLE {table_name} DROP FOREIGN KEY {constraint_name};
 ALTER TABLE {table_name} ADD CONSTRAINT {constraint_name} FOREIGN KEY
 ({other_table_id}) REFERENCES {other_table_name} (id);

 In other words, it is pointlessly (?) dropping and creating the same
 foreign key constraint. Supposedly, this was fixed a long time ago for
 v2.1 (https://code.djangoproject.com/ticket/25253). But seems like,
 somehow, it's still present.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33903>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701827779522a-c8085e58-76e5-450a-90c0-d7fd2f0a468a-000000%40eu-central-1.amazonses.com.

Reply via email to