Ticket #388 (closed defect: invalid)
schemamigration attempts to migrate GenericRelation
|Reported by:||jfunk@…||Owned by:||andrew|
schemamigration --auto currently attempts to set up migrations for GenericRelations. This results in the following error during the actual migration:
File "/usr/lib/python2.6/site-packages/south/db/generic.py", line 205, in create_table for field_name, field in fields File "/usr/lib/python2.6/site-packages/south/db/generic.py", line 471, in column_sql field = self._field_sanity(field) File "/usr/lib/python2.6/site-packages/south/db/mysql.py", line 158, in _field_sanity if self._db_type_for_alter_column(field).upper() in ["BLOB", "TEXT", "LONGTEXT"]: AttributeError: 'NoneType' object has no attribute 'upper'
This happens because GenericRelations emulate relationships and do not actually represent db columns, so the db column type, as returned by field.type() is None.
South should probably skip any field where .type() returns None when detecting migrations.
If I remove the GenericRelation? lines from the resulting migration file, the migration succeeds and the model behaves properly.