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.
This commit is contained in:
Adam Chainz 2016-11-05 22:23:57 +01:00 committed by Simon Charette
parent d1dbaeaadb
commit c7dddc01d6
1 changed files with 4 additions and 0 deletions

View File

@ -9,6 +9,10 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_alter_column_null = "MODIFY %(column)s %(type)s NULL"
sql_alter_column_not_null = "MODIFY %(column)s %(type)s NOT NULL"
sql_alter_column_type = "MODIFY %(column)s %(type)s"
# No 'CASCADE' which works as a no-op in MySQL but is undocumented
sql_delete_column = "ALTER TABLE %(table)s DROP COLUMN %(column)s"
sql_rename_column = "ALTER TABLE %(table)s CHANGE %(old_column)s %(new_column)s %(type)s"
sql_delete_unique = "ALTER TABLE %(table)s DROP INDEX %(name)s"