Ticket #452 (closed defect: wontfix)
0.7 does not work with 0.6 migrations where custome fields are referenced
| Reported by: | artem.skvira@… | Owned by: | andrew |
|---|---|---|---|
| Priority: | major | Milestone: | 0.7.1 |
| Component: | migrations | Version: | 0.7 |
| Keywords: | Cc: |
Description
When trying to rollback the migration, south fails on the ones created before 0.7 and containing references to the custom fields.
In 0.6 those were created like the following:
'mobile': ('PhoneNumberField?', [], {}),
However 0.7 fails on them with this message:
Rolling back DB...
Traceback (most recent call last):
...
db.alter_column('app_business', 'mobile', self.gf('PhoneNumberField?')())
File "/home/user/Dropbox/app/external/south/v2.py", line 12, in gf
return ask_for_it_by_name(field_name)
File "/home/user/Dropbox/app/external/south/utils.py", line 27, in ask_for_it_by_name
ask_for_it_by_name.cache[name] = _ask_for_it_by_name(name)
File "/home/user/Dropbox/app/external/south/utils.py", line 16, in _ask_for_it_by_name
module = import(modulename, {}, {}, bits[-1])
ImportError?: No module named PhoneNumberField?

This is a known incompatibility, and is mentioned (perhaps too subtly) in the release notes: http://south.aeracode.org/docs/releasenotes/0.7.html#backwards-incompatible-changes
The fix is to either make a new empty migration with schemamigration --empty appname 07_fix (before you make any changes), to get a new baseline that the automigrator can use, or to replace the "PhoneNumberField?" string in the old migration's models dict with the full path, like "foo.bar.fields.PhoneNumberField?".