Ticket #5680: autoindex.diff
File autoindex.diff, 3.3 KB (added by , 17 years ago) |
---|
-
django/db/backends/mysql_old/base.py
64 64 return getattr(self.cursor, attr) 65 65 66 66 class DatabaseFeatures(BaseDatabaseFeatures): 67 autoindexes_primary_keys = False 67 pass 68 68 69 69 class DatabaseOperations(BaseDatabaseOperations): 70 70 def date_extract_sql(self, lookup_type, field_name): -
django/db/backends/mysql/base.py
60 60 # TRADITIONAL will automatically cause most warnings to be treated as errors. 61 61 62 62 class DatabaseFeatures(BaseDatabaseFeatures): 63 autoindexes_primary_keys = False 63 pass 64 64 65 65 class DatabaseOperations(BaseDatabaseOperations): 66 66 def date_extract_sql(self, lookup_type, field_name): -
django/db/backends/__init__.py
42 42 class BaseDatabaseFeatures(object): 43 43 allows_group_by_ordinal = True 44 44 allows_unique_and_pk = True 45 autoindexes_primary_keys = True46 45 needs_datetime_string_cast = True 47 46 needs_upper_for_iops = False 48 47 supports_constraints = True -
django/core/management/sql.py
267 267 field_output.append(style.SQL_KEYWORD('UNIQUE')) 268 268 if f.primary_key: 269 269 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): 271 271 # We must specify the index tablespace inline, because we 272 272 # won't be generating a CREATE INDEX statement for this field. 273 273 field_output.append(connection.ops.tablespace_sql(tablespace, inline=True)) … … 348 348 for f in opts.many_to_many: 349 349 if not isinstance(f.rel, generic.GenericRel): 350 350 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: 352 352 tablespace_sql = ' ' + connection.ops.tablespace_sql(tablespace, inline=True) 353 353 else: 354 354 tablespace_sql = '' … … 427 427 428 428 qn = connection.ops.quote_name 429 429 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): 431 431 unique = f.unique and 'UNIQUE ' or '' 432 432 tablespace = f.db_tablespace or model._meta.db_tablespace 433 433 if tablespace and connection.features.supports_tablespaces: