Exemple #1
0
 def _run_migration(self, migration):
     if migration.no_dry_run():
         if self.verbosity:
             print(" - Migration '%s' is marked for no-dry-run." % migration)
         return
     for name, db in iteritems(south.db.dbs):
         south.db.dbs[name].dry_run = True
     # preserve the constraint cache as it can be mutated by the dry run
     constraint_cache = deepcopy(south.db.db._constraint_cache)
     if self._ignore_fail:
         south.db.db.debug, old_debug = False, south.db.db.debug
     pending_creates = south.db.db.get_pending_creates()
     south.db.db.start_transaction()
     migration_function = self.direction(migration)
     try:
         try:
             migration_function()
             south.db.db.execute_deferred_sql()
         except BaseException:
             raise exceptions.FailedDryRun(migration, sys.exc_info())
     finally:
         south.db.db.rollback_transactions_dry_run()
         if self._ignore_fail:
             south.db.db.debug = old_debug
         south.db.db.clear_run_data(pending_creates)
         for name, db in iteritems(south.db.dbs):
             south.db.dbs[name].dry_run = False
         # restore the preserved constraint cache from before dry run was
         # executed
         south.db.db._constraint_cache = constraint_cache
Exemple #2
0
 def _run_migration(self, migration):
     if migration.no_dry_run() and self.verbosity:
         print " - Migration '%s' is marked for no-dry-run."
         return
     db.dry_run = True
     db.debug, old_debug = False, db.debug
     pending_creates = db.get_pending_creates()
     db.start_transaction()
     migration_function = self.direction(migration)
     try:
         try:
             migration_function()
         except:
             raise exceptions.FailedDryRun(migration, sys.exc_info())
     finally:
         db.rollback_transactions_dry_run()
         db.debug = old_debug
         db.clear_run_data(pending_creates)
         db.dry_run = False
Exemple #3
0
 def _run_migration(self, migration):
     if migration.no_dry_run() and self.verbosity:
         print " - Migration '%s' is marked for no-dry-run." % migration
         return
     south.db.db.dry_run = True
     if self._ignore_fail:
         south.db.db.debug, old_debug = False, south.db.db.debug
     pending_creates = south.db.db.get_pending_creates()
     south.db.db.start_transaction()
     migration_function = self.direction(migration)
     try:
         try:
             migration_function()
             south.db.db.execute_deferred_sql()
         except:
             raise exceptions.FailedDryRun(migration, sys.exc_info())
     finally:
         south.db.db.rollback_transactions_dry_run()
         if self._ignore_fail:
             south.db.db.debug = old_debug
         south.db.db.clear_run_data(pending_creates)
         south.db.db.dry_run = False