Fixed a group of missing imports, aliases and parameter passings from the

db.backend.creation refactoring.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8328 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-08-12 16:06:55 +00:00
parent e42748dbf5
commit bb5a35cc54
1 changed files with 28 additions and 25 deletions

View File

@ -260,7 +260,7 @@ class BaseDatabaseCreation(object):
output = ['%s %s;' % (style.SQL_KEYWORD('DROP TABLE'), output = ['%s %s;' % (style.SQL_KEYWORD('DROP TABLE'),
style.SQL_TABLE(qn(model._meta.db_table)))] style.SQL_TABLE(qn(model._meta.db_table)))]
if model in references_to_delete: if model in references_to_delete:
output.extend(self.sql_remove_table_constraints(model, references_to_delete)) output.extend(self.sql_remove_table_constraints(model, references_to_delete, style))
if model._meta.has_auto_field: if model._meta.has_auto_field:
ds = self.connection.ops.drop_sequence_sql(model._meta.db_table) ds = self.connection.ops.drop_sequence_sql(model._meta.db_table)
@ -268,8 +268,11 @@ class BaseDatabaseCreation(object):
output.append(ds) output.append(ds)
return output return output
def sql_remove_table_constraints(self, model, references_to_delete): def sql_remove_table_constraints(self, model, references_to_delete, style):
from django.db.backends.util import truncate_name
output = [] output = []
qn = self.connection.ops.quote_name
for rel_class, f in references_to_delete[model]: for rel_class, f in references_to_delete[model]:
table = rel_class._meta.db_table table = rel_class._meta.db_table
col = f.column col = f.column