Changeset 5779
- Timestamp:
- 07/30/07 15:05:02 (1 year ago)
- Files:
-
- django/branches/schema-evolution/django/core/management.py (modified) (2 diffs)
- django/branches/schema-evolution/django/db/backends/mysql/base.py (modified) (1 diff)
- django/branches/schema-evolution/django/db/backends/postgresql/base.py (modified) (1 diff)
- django/branches/schema-evolution/tests/modeltests/schema_evolution (added)
- django/branches/schema-evolution/tests/modeltests/schema_evolution/__init__.py (added)
- django/branches/schema-evolution/tests/modeltests/schema_evolution/models.py (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/schema-evolution/django/core/management.py
r5777 r5779 564 564 for f in opts.fields: 565 565 existing_fields = introspection.get_columns(cursor,db_table) 566 if f.column not in existing_fields and f.aka and f.aka not in existing_fields and len(set(f.aka) & set(existing_fields))==0:566 if f.column not in existing_fields and (not f.aka or f.aka not in existing_fields and len(set(f.aka) & set(existing_fields))==0): 567 567 rel_field = f 568 568 data_type = f.get_internal_type() … … 703 703 output.append( '-- warning: as the following may cause data loss, it/they must be run manually' ) 704 704 for suspect_field in suspect_fields: 705 output.append( backend.get_drop_column_sql( db_table, suspect_field ) )705 output.append( '-- '+ backend.get_drop_column_sql( db_table, suspect_field ) ) 706 706 output.append( '-- end warning' ) 707 707 return output django/branches/schema-evolution/django/db/backends/mysql/base.py
r5735 r5779 281 281 def get_drop_column_sql( table_name, col_name ): 282 282 output = [] 283 output.append( ' --ALTER TABLE '+ quote_name(table_name) +' DROP COLUMN '+ quote_name(col_name) + ';' )283 output.append( 'ALTER TABLE '+ quote_name(table_name) +' DROP COLUMN '+ quote_name(col_name) + ';' ) 284 284 return '\n'.join(output) 285 285 django/branches/schema-evolution/django/db/backends/postgresql/base.py
r5735 r5779 316 316 def get_drop_column_sql( table_name, col_name ): 317 317 output = [] 318 output.append( ' --ALTER TABLE '+ quote_name(table_name) +' DROP COLUMN '+ quote_name(col_name) + ';' )318 output.append( 'ALTER TABLE '+ quote_name(table_name) +' DROP COLUMN '+ quote_name(col_name) + ';' ) 319 319 return '\n'.join(output) 320 320
