Author: david
Date: Fri May  4 17:16:25 2012
New Revision: 11642

Log:
Update data version after every update to prevent leaving data in inconsistent 
state in case of a sql error

Modified:
   trunk/lib/task/migrate/arUpgradeSqlTask.class.php

Modified: trunk/lib/task/migrate/arUpgradeSqlTask.class.php
==============================================================================
--- trunk/lib/task/migrate/arUpgradeSqlTask.class.php   Fri May  4 16:14:25 
2012        (r11641)
+++ trunk/lib/task/migrate/arUpgradeSqlTask.class.php   Fri May  4 17:16:25 
2012        (r11642)
@@ -131,15 +131,13 @@
         $this->logSection('upgrade-sql', sprintf('Upgrading from Release %s', 
$class::MILESTONE));
         while ($class->up($version))
         {
-          $version++;
+          // Update version in database
+          $sql = 'UPDATE setting_i18n SET value=? WHERE id = (SELECT id FROM 
setting WHERE name=?);';
+          QubitPdo::modify($sql, array(++$version, 'version'));
         }
       }
     }
 
-    // Upgrade version in database
-    $sql = 'UPDATE setting_i18n SET value=? WHERE id = (SELECT id FROM setting 
WHERE name=?);';
-    QubitPdo::modify($sql, array($version, 'version'));
-
     if ($this->initialVersion == $version)
     {
       $this->logSection('upgrade-sql', sprintf('Already at latest version 
(%s), no upgrades done', $version));

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to