Opened 7 years ago

Closed 7 years ago

#27441 closed Cleanup/optimization (fixed)

MySQL backend output for 'DROP COLUMN' uses undocumented SQL

Reported by: Adam Johnson Owned by: Adam Johnson
Component: Migrations Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Django's default SchemaEditor outputs DROP COLUMN ... CASCADE. When inspecting the SQL for a migration I saw this and wondered what the CASCADE means - it's not documented on MySQL ( http://dev.mysql.com/doc/refman/5.7/en/alter-table.html ), but I discovered it is a no-op added for compatibility with e.g. postgres where it does mean something. I added this to the MariaDB documentation ( https://mariadb.com/kb/en/mariadb/alter-table/ ) because it's editable, but it's not going to get added to the MySQL documentation any time soon.

Since it's potentially confusing and a no-op, I think Django shouldn't output CASCADE on MySQL.

Change History (3)

comment:1 by Adam Johnson, 7 years ago

Has patch: set
Owner: changed from nobody to Adam Johnson
Status: newassigned

comment:2 by Tim Graham, 7 years ago

Triage Stage: UnreviewedReady for checkin

comment:3 by Simon Charette <charettes@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In c7dddc0:

Fixed #27441 -- Improved SQL for 'DROP COLUMN' on MySQL

'CASCADE' is an undocumented no-op in MySQL, so to avoid confusion Django no longer outputs it.

Note: See TracTickets for help on using tickets.
Back to Top