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);
}
}
-# 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";
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,