Changeset 5777
- Timestamp:
- 07/30/07 12:10:05 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/schema-evolution/django/core/management.py
r5735 r5777 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 not in existing_fields and len(set(f.aka) & set(existing_fields))==0: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: 567 567 rel_field = f 568 568 data_type = f.get_internal_type() … … 610 610 for f in opts.fields: 611 611 existing_fields = introspection.get_columns(cursor,db_table) 612 if f.column not in existing_fields and (f.aka in existing_fields or len(set(f.aka) & set(existing_fields)))==1:612 if f.column not in existing_fields and f.aka and (f.aka in existing_fields or len(set(f.aka) & set(existing_fields)))==1: 613 613 old_col = None 614 614 if isinstance( f.aka, str ): … … 649 649 elif f.aka in existing_fields: 650 650 cf = f.aka 651 elif len(set(f.aka) & set(existing_fields))==1:651 elif f.aka and len(set(f.aka) & set(existing_fields))==1: 652 652 cf = f.aka[0] 653 653 else: … … 693 693 db_table = new_table_name 694 694 suspect_fields = set(introspection.get_columns(cursor,db_table)) 695 # print 'suspect_fields = ', suspect_fields 695 696 for f in opts.fields: 697 # print 'f = ', f 698 # print 'f.aka = ', f.aka 696 699 suspect_fields.discard(f.column) 697 700 suspect_fields.discard(f.aka) 698 suspect_fields.difference_update(f.aka)701 if f.aka: suspect_fields.difference_update(f.aka) 699 702 if len(suspect_fields)>0: 700 703 output.append( '-- warning: as the following may cause data loss, it/they must be run manually' ) 701 for suspect_field in suspect_fields:702 output.append( backend.get_drop_column_sql( db_table, suspect_field ) )704 for suspect_field in suspect_fields: 705 output.append( backend.get_drop_column_sql( db_table, suspect_field ) ) 703 706 output.append( '-- end warning' ) 704 707 return output
