Fixed #31411 -- Used RENAME COLUMN on MariaDB 10.5.2+.
This commit is contained in:
parent
b1f88476db
commit
1fe3e24264
|
@ -13,8 +13,6 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
|
||||||
# No 'CASCADE' which works as a no-op in MySQL but is undocumented
|
# 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_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"
|
sql_delete_unique = "ALTER TABLE %(table)s DROP INDEX %(name)s"
|
||||||
sql_create_column_inline_fk = (
|
sql_create_column_inline_fk = (
|
||||||
', ADD CONSTRAINT %(name)s FOREIGN KEY (%(column)s) '
|
', ADD CONSTRAINT %(name)s FOREIGN KEY (%(column)s) '
|
||||||
|
@ -38,6 +36,12 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
|
||||||
return 'ALTER TABLE %(table)s DROP CONSTRAINT IF EXISTS %(name)s'
|
return 'ALTER TABLE %(table)s DROP CONSTRAINT IF EXISTS %(name)s'
|
||||||
return 'ALTER TABLE %(table)s DROP CHECK %(name)s'
|
return 'ALTER TABLE %(table)s DROP CHECK %(name)s'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def sql_rename_column(self):
|
||||||
|
if self.connection.mysql_is_mariadb and self.connection.mysql_version >= (10, 5, 2):
|
||||||
|
return super().sql_rename_column
|
||||||
|
return 'ALTER TABLE %(table)s CHANGE %(old_column)s %(new_column)s %(type)s'
|
||||||
|
|
||||||
def quote_value(self, value):
|
def quote_value(self, value):
|
||||||
self.connection.ensure_connection()
|
self.connection.ensure_connection()
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
|
|
Loading…
Reference in New Issue