1. Luke Plant
  2. south


Sebastian Noack  committed f1e34ab

Pass the current instead of the previous frozen ORM to
backwards() in new data migrations.
Before always the previous migration's frozen ORM was used when migrating
backwards. But that became a big issue for data migrations that need additional
apps (given with --freeze). See #428.
docs/ormfreezing.rst | 7 +++++++
south/management/commands/datamigration.py | 1 +
south/migration/base.py | 2 ++
3 files changed, 10 insertions(+), 0 deletions(-)

  • Participants
  • Parent commits 2ffeac0
  • Branches default

Comments (0)

Files changed (3)

File docs/ormfreezing.rst

View file
  • Ignore whitespace
 relationships, but if you want to add other models in, simply pass ``--freeze appname``
 to the ``./manage.py datamigration`` command.
+Also note that the ``backwards()`` method gets the ORM as frozen by the previous
+migration except for migrations that define ``symmetrical = True`` (new in South 1.0)
 Frozen Meta Attributes

File south/management/commands/datamigration.py

View file
  • Ignore whitespace
     models = %(frozen_models)s
+    symmetrical = True

File south/migration/base.py

View file
  • Ignore whitespace
             return False
     def prev_orm(self):
+        if getattr(self.migration_class(), 'symmetrical', False):
+            return self.orm()
         previous = self.previous()
         if previous is None:
             # First migration? The 'previous ORM' is empty.