Commits

Anonymous 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(-)

Comments (0)

Files changed (3)

docs/ormfreezing.rst

 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
 ----------------------
 

south/management/commands/datamigration.py

     models = %(frozen_models)s
 
     %(complete_apps)s
+    symmetrical = True
 """

south/migration/base.py

             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.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.