From 1a6d07783d980664312ce729e1fc8867ad1a3b5c Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Mon, 24 Sep 2012 12:19:32 +0100 Subject: [PATCH] Do cheaper check for column having a type. --- django/db/backends/schema.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django/db/backends/schema.py b/django/db/backends/schema.py index 99a84204af..2e064909cb 100644 --- a/django/db/backends/schema.py +++ b/django/db/backends/schema.py @@ -347,11 +347,11 @@ class BaseDatabaseSchemaEditor(object): # Special-case implicit M2M tables if isinstance(field, ManyToManyField) and field.rel.through._meta.auto_created: 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 definition, params = self.column_sql(model, field) - # It might not actually have a column behind it - if definition is None: - return # Delete the column sql = self.sql_delete_column % { "table": self.quote_name(model._meta.db_table),