1
0
mirror of https://github.com/django/django.git synced 2024-12-24 18:16:19 +00:00

[1.7.x] Fixed #22498 -- constraint name was not quoted in FK creation SQL

Backport of 843613add4 from master
This commit is contained in:
Shai Berger 2014-04-25 01:30:43 +03:00
parent 7421e1e320
commit b8b179bbf5

View File

@ -419,11 +419,11 @@ class BaseDatabaseSchemaEditor(object):
to_column = field.rel.to._meta.get_field(field.rel.field_name).column to_column = field.rel.to._meta.get_field(field.rel.field_name).column
self.deferred_sql.append( self.deferred_sql.append(
self.sql_create_fk % { self.sql_create_fk % {
"name": '%s_refs_%s_%x' % ( "name": self.quote_name('%s_refs_%s_%x' % (
field.column, field.column,
to_column, to_column,
abs(hash((model._meta.db_table, to_table))) abs(hash((model._meta.db_table, to_table)))
), )),
"table": self.quote_name(model._meta.db_table), "table": self.quote_name(model._meta.db_table),
"column": self.quote_name(field.column), "column": self.quote_name(field.column),
"to_table": self.quote_name(to_table), "to_table": self.quote_name(to_table),