Updated for 1.7.4
[freeside.git] / FS / bin / freeside-upgrade
index 0fa2133..006596f 100755 (executable)
@@ -46,23 +46,28 @@ if (dbdef->table('cust_main')->column('agent_custid') && ! $opt_s) {
       if (dbdef->table('h_cust_main')); 
 }
 
+my @statements =
+  grep { $_ !~ /^CREATE +INDEX +h_queue/ } #useless, holds up queue insertion
+       dbdef->sql_update_schema( dbdef_dist(datasrc), $dbh );
+
 if ( $DRY_RUN ) {
   print
-    join(";\n", @bugfix, dbdef->sql_update_schema( dbdef_dist(datasrc), $dbh ) ). ";\n";
+    join(";\n", @bugfix, @statements ). ";\n";
   exit;
 } else {
-  foreach my $statement ( @bugfix ) {
+  foreach my $statement ( @bugfix, @statements ) {
     $dbh->do( $statement )
       or die "Error: ". $dbh->errstr. "\n executing: $statement";
   }
 
-  dbdef->update_schema( dbdef_dist(datasrc), $dbh );
+#  dbdef->update_schema( dbdef_dist(datasrc), $dbh );
 }
 
 my $hashref = {};
 $hashref->{dry_run} = 1 if $DRY_RUN;
-$hashref->{debug} = 1 if $DEBUG;
-print join "\n", prune_applications($hashref) unless $opt_s;
+$hashref->{debug} = 1 if $DEBUG && $DRY_RUN;
+prune_applications($hashref) unless $opt_s;
+
 print "\n" if $DRY_RUN;
 
 if ( $dbh->{Driver}->{Name} =~ /^mysql/i && ! $opt_s ) {
@@ -92,13 +97,13 @@ reload_dbdef($dbdef_file);
 upgrade()
   unless $DRY_RUN || $opt_s;
 
+$dbh->commit or die $dbh->errstr;
+
 upgrade_sqlradius()
   unless $DRY_RUN || $opt_s;
 
 $dbh->commit or die $dbh->errstr;
 
-dbdef_create($dbh, $dbdef_file);
-
 $dbh->disconnect or die $dbh->errstr;
 
 ###