Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use create_index_name for FK names

  • Loading branch information...
commit b6784bee66d2c310318b6553fbb13f5707475efb 1 parent 15c1920
Andrew Godwin authored September 24, 2012

Showing 1 changed file with 1 addition and 5 deletions. Show diff stats Hide diff stats

  1. 6  django/db/backends/schema.py
6  django/db/backends/schema.py
@@ -199,11 +199,7 @@ def create_model(self, model):
199 199
                 to_column = field.rel.to._meta.get_field(field.rel.field_name).column
200 200
                 self.deferred_sql.append(
201 201
                     self.sql_create_fk % {
202  
-                        "name": '%s_refs_%s_%x' % (
203  
-                            field.column,
204  
-                            to_column,
205  
-                            abs(hash((model._meta.db_table, to_table)))
206  
-                        ),
  202
+                        "name": self._create_index_name(model, [field.column], suffix="_fk_%s_%s" % (to_table, to_column)),
207 203
                         "table": self.quote_name(model._meta.db_table),
208 204
                         "column": self.quote_name(field.column),
209 205
                         "to_table": self.quote_name(to_table),

0 notes on commit b6784be

Please sign in to comment.
Something went wrong with that request. Please try again.