#33185: sqlmigrate crashes given a RenameModel operation with a self-referencing
foreign key
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Sidharth
| Dusanapudi
Type: Bug | Status: closed
Component: Migrations | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jacob Walls <jacobtylerwalls@…>):
In [changeset:"9892449102da236c57ee9362ef9d0b7a9e81c13e" 98924491]:
{{{#!CommitTicketReference repository=""
revision="9892449102da236c57ee9362ef9d0b7a9e81c13e"
[6.1.x] Fixed #33185 -- Fixed sqlmigrate crash for RenameModel with a
self-referential foreign key.
When collecting SQL (e.g. for sqlmigrate), a RenameModel operation's
table rename is not executed, so the subsequent field alteration
introspected the renamed table before it existed. On MySQL this raised
"Table doesn't exist", and on PostgreSQL the missing introspection
silently omitted the self-referential foreign key's drop and recreate.
The schema editor now records table renames while collecting SQL and
redirects constraint-name introspection to the still-existing old table
name, which carries the same constraints. Applying migrations is
unaffected.
Backport of c6f81b383251dc9fd0918b4ba040c993444b931e from main.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33185#comment:21>
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 visit
https://groups.google.com/d/msgid/django-updates/0107019eb7030140-941a8aaa-38e3-494a-9e81-6d1a2710ffc7-000000%40eu-central-1.amazonses.com.