correct order of operations
authorjeff <jeff>
Fri, 14 Dec 2007 21:32:32 +0000 (21:32 +0000)
committerjeff <jeff>
Fri, 14 Dec 2007 21:32:32 +0000 (21:32 +0000)
FS/bin/freeside-upgrade

index 01ca00c..0e1d076 100755 (executable)
@@ -93,14 +93,6 @@ if ( $dbh->{Driver}->{Name} =~ /^mysql/i ) {
   }
 }
 
-$dbh->commit or die $dbh->errstr;  # we *MUST* commit before upgrading data
-dbdef_create($dbh, $dbdef_file);
-delete $FS::Schema::dbdef_cache{$dbdef_file}; #force an actual reload
-$dbh = adminsuidsetup($user);
-
-upgrade()
-  unless $DRY_RUN;
-
 $dbh->commit or die $dbh->errstr;
 
 dbdef_create($dbh, $dbdef_file);
@@ -126,6 +118,14 @@ unless ( $DRY_RUN ) {
 $dbh->commit or die $dbh->errstr;
 $dbh->disconnect or die $dbh->errstr;
 
+$dbh = adminsuidsetup($user);
+
+upgrade()
+  unless $DRY_RUN;
+
+$dbh->commit or die $dbh->errstr;
+$dbh->disconnect or die $dbh->errstr;
+
 ###
 
 sub dbdef_create { # reverse engineer the schema from the DB and save to file