Ticket #5680: autoindex.2.diff

File autoindex.2.diff, 3.8 KB (added by Erin Kelly, 16 years ago)

Updated patch after [7375]

  • django/db/backends/mysql_old/base.py

     
    6464            return getattr(self.cursor, attr)
    6565
    6666class DatabaseFeatures(BaseDatabaseFeatures):
    67     autoindexes_primary_keys = False
    6867    inline_fk_references = False
    6968
    7069class DatabaseOperations(BaseDatabaseOperations):
  • django/db/backends/mysql/base.py

     
    6060# TRADITIONAL will automatically cause most warnings to be treated as errors.
    6161
    6262class DatabaseFeatures(BaseDatabaseFeatures):
    63     autoindexes_primary_keys = False
    6463    inline_fk_references = False
    6564
    6665class DatabaseOperations(BaseDatabaseOperations):
  • django/db/backends/__init__.py

     
    4242class BaseDatabaseFeatures(object):
    4343    allows_group_by_ordinal = True
    4444    allows_unique_and_pk = True
    45     autoindexes_primary_keys = True
    4645    inline_fk_references = True
    4746    needs_datetime_string_cast = True
    4847    needs_upper_for_iops = False
  • django/core/management/sql.py

     
    273273            field_output.append(style.SQL_KEYWORD('UNIQUE'))
    274274        if f.primary_key:
    275275            field_output.append(style.SQL_KEYWORD('PRIMARY KEY'))
    276         if tablespace and connection.features.supports_tablespaces and (f.unique or f.primary_key) and connection.features.autoindexes_primary_keys:
     276        if tablespace and connection.features.supports_tablespaces and (f.unique or f.primary_key):
    277277            # We must specify the index tablespace inline, because we
    278278            # won't be generating a CREATE INDEX statement for this field.
    279279            field_output.append(connection.ops.tablespace_sql(tablespace, inline=True))
     
    297297        constraint_output = [style.SQL_KEYWORD('UNIQUE')]
    298298        constraint_output.append('(%s)' % \
    299299            ", ".join([style.SQL_FIELD(qn(opts.get_field(f).column)) for f in field_constraints]))
    300         if opts.db_tablespace and connection.features.supports_tablespaces \
    301                and connection.features.autoindexes_primary_keys:
     300        if opts.db_tablespace and connection.features.supports_tablespaces:
    302301            constraint_output.append(connection.ops.tablespace_sql(
    303302                opts.db_tablespace, inline=True))
    304303        table_output.append(' '.join(constraint_output))
     
    362361    for f in opts.many_to_many:
    363362        if not isinstance(f.rel, generic.GenericRel):
    364363            tablespace = f.db_tablespace or opts.db_tablespace
    365             if tablespace and connection.features.supports_tablespaces and connection.features.autoindexes_primary_keys:
     364            if tablespace and connection.features.supports_tablespaces:
    366365                tablespace_sql = ' ' + connection.ops.tablespace_sql(tablespace, inline=True)
    367366            else:
    368367                tablespace_sql = ''
     
    467466
    468467    qn = connection.ops.quote_name
    469468    for f in model._meta.fields:
    470         if f.db_index and not ((f.primary_key or f.unique) and connection.features.autoindexes_primary_keys):
     469        if f.db_index and not (f.primary_key or f.unique):
    471470            unique = f.unique and 'UNIQUE ' or ''
    472471            tablespace = f.db_tablespace or model._meta.db_tablespace
    473472            if tablespace and connection.features.supports_tablespaces:
Back to Top