summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoulder Sprinters <boulder-sprinters@djangoproject.com>2006-11-05 00:26:17 +0000
committerBoulder Sprinters <boulder-sprinters@djangoproject.com>2006-11-05 00:26:17 +0000
commitabd5b14d6fa88780730e5a82af4d121905f74fc7 (patch)
tree108ffc3113a5ede2cdfd28dc1d3b122ad9c0243a
parent58f0b44c74ca3a340f715cadc9f3ffe88ce47108 (diff)
[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
-rw-r--r--django/core/management.py6
1 files 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