From 7a8965a3a180bc5db7421299fcd6ab92df6d017b Mon Sep 17 00:00:00 2001 From: Boulder Sprinters Date: Sat, 4 Nov 2006 21:05:35 +0000 Subject: [PATCH] [boulder-oracle-sprint] Added truncate_name to CREATE INDEX code git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@3983 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/management.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/django/core/management.py b/django/core/management.py index b0d32ff19b..0b3866e818 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -444,6 +444,7 @@ get_sql_indexes.args = APP_ARGS def get_sql_indexes_for_model(model): "Returns the CREATE INDEX SQL statements for a single model" from django.db import backend + from django.db.backends.util import truncate_name output = [] for f in model._meta.fields: @@ -451,7 +452,7 @@ def get_sql_indexes_for_model(model): unique = f.unique and 'UNIQUE ' or '' output.append( style.SQL_KEYWORD('CREATE %sINDEX' % unique) + ' ' + \ - style.SQL_TABLE('%s_%s' % (model._meta.db_table, f.column)) + ' ' + \ + truncate_name(style.SQL_TABLE('%s_%s' % (model._meta.db_table, f.column)), backend.get_max_name_length()) + ' ' + \ style.SQL_KEYWORD('ON') + ' ' + \ style.SQL_TABLE(backend.quote_name(model._meta.db_table)) + ' ' + \ "(%s);" % style.SQL_FIELD(backend.quote_name(f.column))