Ticket #5680: autoindex.diff

File autoindex.diff, 3.3 KB (added by Nis Jørgensen <nis@…>, 8 years ago)

Fixes just this issue

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

     
    6464            return getattr(self.cursor, attr)
    6565
    6666class DatabaseFeatures(BaseDatabaseFeatures):
    67     autoindexes_primary_keys = False
     67        pass
    6868
    6969class DatabaseOperations(BaseDatabaseOperations):
    7070    def date_extract_sql(self, lookup_type, field_name):
  • 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
     63        pass
    6464
    6565class DatabaseOperations(BaseDatabaseOperations):
    6666    def date_extract_sql(self, lookup_type, field_name):
  • 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    needs_datetime_string_cast = True
    4746    needs_upper_for_iops = False
    4847    supports_constraints = True
  • django/core/management/sql.py

     
    267267            field_output.append(style.SQL_KEYWORD('UNIQUE'))
    268268        if f.primary_key:
    269269            field_output.append(style.SQL_KEYWORD('PRIMARY KEY'))
    270         if tablespace and connection.features.supports_tablespaces and (f.unique or f.primary_key) and connection.features.autoindexes_primary_keys:
     270        if tablespace and connection.features.supports_tablespaces and (f.unique or f.primary_key):
    271271            # We must specify the index tablespace inline, because we
    272272            # won't be generating a CREATE INDEX statement for this field.
    273273            field_output.append(connection.ops.tablespace_sql(tablespace, inline=True))
     
    348348    for f in opts.many_to_many:
    349349        if not isinstance(f.rel, generic.GenericRel):
    350350            tablespace = f.db_tablespace or opts.db_tablespace
    351             if tablespace and connection.features.supports_tablespaces and connection.features.autoindexes_primary_keys:
     351            if tablespace and connection.features.supports_tablespaces:
    352352                tablespace_sql = ' ' + connection.ops.tablespace_sql(tablespace, inline=True)
    353353            else:
    354354                tablespace_sql = ''
     
    427427
    428428    qn = connection.ops.quote_name
    429429    for f in model._meta.fields:
    430         if f.db_index and not ((f.primary_key or f.unique) and connection.features.autoindexes_primary_keys):
     430        if f.db_index and not (f.primary_key or f.unique):
    431431            unique = f.unique and 'UNIQUE ' or ''
    432432            tablespace = f.db_tablespace or model._meta.db_tablespace
    433433            if tablespace and connection.features.supports_tablespaces:
Back to Top