I have recenty came across a problem while importing older data than my current model schema. Flow which I use and lead to error:
- dumpdata with python manage.py dumpdata -> 0002
- make some modifications to model
- generate migration with python manage.py schemamigration app_name --auto -> 0003
- run migration
- play with database
- migrate to 0002
- loaddata generate SQL in which I have current (migration 0003) fields, and cause failing loaddata process (mpoly is added field)
File "/usr/local/lib/python2.6/dist-packages/django/db/backends/postgresql_psycopg2/base.py",
line 44, in execute return self.cursor.execute(query, args) DatabaseError: column "mpoly" of relation "localization_province" does not exist LINE 1: ...e" ("id", "name", "slug", "mpoly") V...
- commenting changes in models.py done before 0003, make all working ok
Is there any way to avoid playing with models after backward migration if I want to loaddata?
Maybe I'm missing something really obvious...
PS: I'm using South 7.3, Django 1.2.3 and PostgreSQL 8.4 as database backend.