merge NG auth, RT#21563
[freeside.git] / FS / bin / freeside-upgrade
index 6f4e439..5bd1415 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; #0.39
-use FS::UID qw(adminsuidsetup checkeuid datasrc driver_name);  #getsecrets);
+use FS::UID qw(adminsuidsetup checkeuid datasrc driver_name);
 use FS::CurrentUser;
 use FS::Schema qw( dbdef dbdef_dist reload_dbdef );
 use FS::Misc::prune qw(prune_applications);
@@ -84,21 +84,6 @@ if ( dbdef->table('areacode') and
   }
 }
 
-# RT required field flag
-# for consistency with RT schema: mysql is in CamelCase,
-# pg is in lowercase, and they use different data types.
-my ($t, $creq, $cdis) = 
-  map { driver_name =~ /^mysql/i ? $_ : lc($_) }
-  ('CustomFields','Required','Disabled');
-
-if ( dbdef->table($t) && 
-     ! dbdef->table($t)->column($creq) ) {
-  push @bugfix,
-    "ALTER TABLE $t ADD COLUMN $creq ".
-    dbdef->table($t)->column($cdis)->type .
-    ' NOT NULL DEFAULT 0';
-}
-
 if ( $DRY_RUN ) {
   print
     join(";\n", @bugfix ). ";\n";
@@ -138,6 +123,8 @@ my $cf;
 while ( $cf = $cfsth->fetchrow_hashref ) {
     my $tbl = $cf->{'dbtable'};
     my $name = $cf->{'name'};
+    $name = lc($name) unless driver_name =~ /^mysql/i;
+
     @statements = grep { $_ !~ /^\s*ALTER\s+TABLE\s+(h_|)$tbl\s+DROP\s+COLUMN\s+cf_$name\s*$/i }
                                                                     @statements;
     push @statements,