mirror of https://github.com/django/django.git
Added inline Oracle tablespace SQL for unique_together constraints.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7375 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
4c3fcbc4bc
commit
bd3c955bd5
|
@ -294,8 +294,14 @@ def sql_model_create(model, style, known_models=set()):
|
||||||
style.SQL_COLTYPE(models.IntegerField().db_type()) + ' ' + \
|
style.SQL_COLTYPE(models.IntegerField().db_type()) + ' ' + \
|
||||||
style.SQL_KEYWORD('NULL'))
|
style.SQL_KEYWORD('NULL'))
|
||||||
for field_constraints in opts.unique_together:
|
for field_constraints in opts.unique_together:
|
||||||
table_output.append(style.SQL_KEYWORD('UNIQUE') + ' (%s)' % \
|
constraint_output = [style.SQL_KEYWORD('UNIQUE')]
|
||||||
|
constraint_output.append('(%s)' % \
|
||||||
", ".join([style.SQL_FIELD(qn(opts.get_field(f).column)) for f in field_constraints]))
|
", ".join([style.SQL_FIELD(qn(opts.get_field(f).column)) for f in field_constraints]))
|
||||||
|
if opts.db_tablespace and connection.features.supports_tablespaces \
|
||||||
|
and connection.features.autoindexes_primary_keys:
|
||||||
|
constraint_output.append(connection.ops.tablespace_sql(
|
||||||
|
opts.db_tablespace, inline=True))
|
||||||
|
table_output.append(' '.join(constraint_output))
|
||||||
|
|
||||||
full_statement = [style.SQL_KEYWORD('CREATE TABLE') + ' ' + style.SQL_TABLE(qn(opts.db_table)) + ' (']
|
full_statement = [style.SQL_KEYWORD('CREATE TABLE') + ' ' + style.SQL_TABLE(qn(opts.db_table)) + ' (']
|
||||||
for i, line in enumerate(table_output): # Combine and add commas.
|
for i, line in enumerate(table_output): # Combine and add commas.
|
||||||
|
|
Loading…
Reference in New Issue