noise reduction
[freeside.git] / FS / bin / freeside-upgrade
index 6ced372..49f1df8 100755 (executable)
@@ -5,7 +5,7 @@ use vars qw($opt_d $opt_s $opt_q $opt_v $opt_r);
 use vars qw($DEBUG $DRY_RUN);
 use Getopt::Std;
 use DBIx::DBSchema 0.31;
-use FS::UID qw(adminsuidsetup checkeuid datasrc );  #getsecrets);
+use FS::UID qw(adminsuidsetup checkeuid datasrc driver_name);  #getsecrets);
 use FS::CurrentUser;
 use FS::Schema qw( dbdef dbdef_dist reload_dbdef );
 use FS::Misc::prune qw(prune_applications);
@@ -41,9 +41,9 @@ reload_dbdef($dbdef_file);
 warn "Upgrade startup completed in ". (time-$start). " seconds\n"; # if $DEBUG;
 $start = time;
 
-$DBIx::DBSchema::DEBUG = $DEBUG;
-$DBIx::DBSchema::Table::DEBUG = $DEBUG;
-$DBIx::DBSchema::Index::DEBUG = $DEBUG;
+#$DBIx::DBSchema::DEBUG = $DEBUG;
+#$DBIx::DBSchema::Table::DEBUG = $DEBUG;
+#$DBIx::DBSchema::Index::DEBUG = $DEBUG;
 
 my @bugfix = ();
 
@@ -61,15 +61,23 @@ if (dbdef->table('cust_main')->column('agent_custid') && ! $opt_s) {
 #you'll lose all the part_svc settings it migrates to part_svc_column
 
 my @statements =
-  grep { $_ !~ /^CREATE +INDEX +h_queue/ } #useless, holds up queue insertion
+  grep { $_ !~ /^CREATE +INDEX +h_queue/i } #useless, holds up queue insertion
        dbdef->sql_update_schema( dbdef_dist(datasrc), $dbh );
 
+unless ( driver_name =~ /^mysql/i ) {
+  #not necessary under non-mysql, takes forever on big db
+  @statements =
+    grep { $_ !~ /^ *ALTER +TABLE +h_queue +ALTER +COLUMN +job +TYPE +varchar\(512\) *$/i }
+         @statements;
+}
+
 if ( $DRY_RUN ) {
   print
     join(";\n", @bugfix, @statements ). ";\n";
   exit;
 } else {
   foreach my $statement ( @bugfix, @statements ) {
+    warn "$statement\n";
     $dbh->do( $statement )
       or die "Error: ". $dbh->errstr. "\n executing: $statement";
   }