Do cheaper check for column having a type.
This commit is contained in:
parent
f0e09e27f6
commit
1a6d07783d
|
@ -347,11 +347,11 @@ class BaseDatabaseSchemaEditor(object):
|
||||||
# Special-case implicit M2M tables
|
# Special-case implicit M2M tables
|
||||||
if isinstance(field, ManyToManyField) and field.rel.through._meta.auto_created:
|
if isinstance(field, ManyToManyField) and field.rel.through._meta.auto_created:
|
||||||
return self.delete_model(field.rel.through)
|
return self.delete_model(field.rel.through)
|
||||||
|
# It might not actually have a column behind it
|
||||||
|
if field.db_parameters(connection=self.connection)['type'] is None:
|
||||||
|
return
|
||||||
# Get the column's definition
|
# Get the column's definition
|
||||||
definition, params = self.column_sql(model, field)
|
definition, params = self.column_sql(model, field)
|
||||||
# It might not actually have a column behind it
|
|
||||||
if definition is None:
|
|
||||||
return
|
|
||||||
# Delete the column
|
# Delete the column
|
||||||
sql = self.sql_delete_column % {
|
sql = self.sql_delete_column % {
|
||||||
"table": self.quote_name(model._meta.db_table),
|
"table": self.quote_name(model._meta.db_table),
|
||||||
|
|
Loading…
Reference in New Issue