From abd5b14d6fa88780730e5a82af4d121905f74fc7 Mon Sep 17 00:00:00 2001 From: Boulder Sprinters Date: Sun, 5 Nov 2006 00:26:17 +0000 Subject: [PATCH] [boulder-oracle-sprint] fixed the *other* occurrence of oracle create sequence code with truncate_name git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@4011 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/management.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/django/core/management.py b/django/core/management.py index bb957f7e08..aebc519d35 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -243,6 +243,7 @@ def _get_sql_for_pending_references(model, pending_references): def _get_many_to_many_sql_for_model(model): from django.db import backend, get_creation_module from django.db.models import GenericRel + from django.db.backends.util import truncate_name data_types = get_creation_module().DATA_TYPES @@ -277,7 +278,8 @@ def _get_many_to_many_sql_for_model(model): # To simulate auto-incrementing primary keys in Oracle -- creating m2m tables if (settings.DATABASE_ENGINE == 'oracle'): m_table = f.m2m_db_table() - sequence_statement = 'CREATE SEQUENCE %s_sq;' % m_table + sequence_name = truncate_name('%s_sq' % m_table, backend.get_max_name_length()) + sequence_statement = 'CREATE SEQUENCE %s_sq;' % sequence_name final_output.append(sequence_statement) trigger_statement = '' + \ 'CREATE OR REPLACE trigger %s_tr\n' % m_table + \ @@ -285,7 +287,7 @@ def _get_many_to_many_sql_for_model(model): ' for each row\n' + \ ' when (new.id is NULL)\n' + \ ' begin\n' + \ - ' select %s_sq.NEXTVAL into :new.id from DUAL;\n' % m_table + \ + ' select %s.NEXTVAL into :new.id from DUAL;\n' % sequence_name + \ ' end;\n' final_output.append(trigger_statement) return final_output