Pass type to sql_alter_column*.

This helps databases which need the database type when changing the default
(Just like MySQL needs it for changing null…)
This commit is contained in:
Florian Apolloner 2016-03-18 23:06:43 +01:00
parent cacc7e85e1
commit 37cde8667e
1 changed files with 3 additions and 0 deletions

View File

@ -577,6 +577,7 @@ class BaseDatabaseSchemaEditor(object):
actions.append(( actions.append((
self.sql_alter_column_default % { self.sql_alter_column_default % {
"column": self.quote_name(new_field.column), "column": self.quote_name(new_field.column),
"type": new_type,
"default": self.prepare_default(new_default), "default": self.prepare_default(new_default),
}, },
[], [],
@ -585,6 +586,7 @@ class BaseDatabaseSchemaEditor(object):
actions.append(( actions.append((
self.sql_alter_column_default % { self.sql_alter_column_default % {
"column": self.quote_name(new_field.column), "column": self.quote_name(new_field.column),
"type": new_type,
"default": "%s", "default": "%s",
}, },
[new_default], [new_default],
@ -738,6 +740,7 @@ class BaseDatabaseSchemaEditor(object):
"table": self.quote_name(model._meta.db_table), "table": self.quote_name(model._meta.db_table),
"changes": self.sql_alter_column_no_default % { "changes": self.sql_alter_column_no_default % {
"column": self.quote_name(new_field.column), "column": self.quote_name(new_field.column),
"type": new_type,
} }
} }
self.execute(sql) self.execute(sql)