Daniel Gonçalves avatar Daniel Gonçalves committed 97e9af8

Avoid record ran migrations in dry-run mode.
Method south.migration.Migrator.done_migrate wiped out.

Comments (0)

Files changed (1)

south/migration/migrators.py

         try:
             migration_function()
             south.db.db.execute_deferred_sql()
-            # record us as having done this in the same transaction
-            self.record(migration, database)
+            if not isinstance(getattr(self, '_wrapper', self), DryRunMigrator):
+                # record us as having done this in the same transaction,
+                # since we're not in a dry run
+                self.record(migration, database)
         except:
             south.db.db.rollback_transaction()
             if not south.db.db.has_ddl_transactions:
             if not south.db.db.has_ddl_transactions:
                 dry_run = DryRunMigrator(migrator=self, ignore_fail=False)
                 dry_run.run_migration(migration, database)
-        return self.run_migration(migration)
+        return self.run_migration(migration, database)
 
-    def done_migrate(self, migration, database):
-        south.db.db.start_transaction()
-        try:
-            # Record us as having done this
-            self.record(migration, database)
-        except:
-            south.db.db.rollback_transaction()
-            raise
-        else:
-            south.db.db.commit_transaction()
 
     def send_ran_migration(self, migration):
         ran_migration.send(None,
                 return False
             raise
 
-    def done_migrate(self, *args, **kwargs):
-        pass
-
     def send_ran_migration(self, *args, **kwargs):
         pass
 
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.