Ticket #5680: autoindex.2.diff
File autoindex.2.diff, 3.8 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 = False68 67 inline_fk_references = False 69 68 70 69 class DatabaseOperations(BaseDatabaseOperations): -
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 = False64 63 inline_fk_references = False 65 64 66 65 class DatabaseOperations(BaseDatabaseOperations): -
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 inline_fk_references = True 47 46 needs_datetime_string_cast = True 48 47 needs_upper_for_iops = False -
django/core/management/sql.py
273 273 field_output.append(style.SQL_KEYWORD('UNIQUE')) 274 274 if f.primary_key: 275 275 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): 277 277 # We must specify the index tablespace inline, because we 278 278 # won't be generating a CREATE INDEX statement for this field. 279 279 field_output.append(connection.ops.tablespace_sql(tablespace, inline=True)) … … 297 297 constraint_output = [style.SQL_KEYWORD('UNIQUE')] 298 298 constraint_output.append('(%s)' % \ 299 299 ", ".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: 302 301 constraint_output.append(connection.ops.tablespace_sql( 303 302 opts.db_tablespace, inline=True)) 304 303 table_output.append(' '.join(constraint_output)) … … 362 361 for f in opts.many_to_many: 363 362 if not isinstance(f.rel, generic.GenericRel): 364 363 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: 366 365 tablespace_sql = ' ' + connection.ops.tablespace_sql(tablespace, inline=True) 367 366 else: 368 367 tablespace_sql = '' … … 467 466 468 467 qn = connection.ops.quote_name 469 468 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): 471 470 unique = f.unique and 'UNIQUE ' or '' 472 471 tablespace = f.db_tablespace or model._meta.db_tablespace 473 472 if tablespace and connection.features.supports_tablespaces: