X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Freason.pm;h=5311ec5aa6892d3772ce8e6e4d5b85f1e4a4c76c;hb=bf4223e554e0eb72f45f82392442780e8af4e0f9;hp=3c925d4128cc569d9b2e34075224084ca1ea2048;hpb=e8a09e945986a32f9b7d0a5d546142ada91654ca;p=freeside.git diff --git a/FS/FS/reason.pm b/FS/FS/reason.pm index 3c925d412..5311ec5aa 100644 --- a/FS/FS/reason.pm +++ b/FS/FS/reason.pm @@ -137,7 +137,9 @@ sub _upgrade_data { # class method $column = dbdef->table($self->table)->column('reason'); my $columndef = $column->line($dbh); $columndef =~ s/varchar\(\d+\)/text/i; + if ( $dbh->{Driver}->{Name} eq 'Pg' ) { + my $notnull = $columndef =~ s/not null//i; push @sql,"ALTER TABLE $table RENAME reason TO freeside_upgrade_reason"; push @sql,"ALTER TABLE $table ADD $columndef"; @@ -145,15 +147,20 @@ sub _upgrade_data { # class method push @sql,"ALTER TABLE $table ALTER reason SET NOT NULL" if $notnull; push @sql,"ALTER TABLE $table DROP freeside_upgrade_reason"; - }elsif( $dbh->{Driver}->{Name} =~ /^mysql/i ){ - push @sql,"ALTER TABLE $table MODIFY reason ". $column->line($dbh); - }else{ + + } elsif ( $dbh->{Driver}->{Name} =~ /^mysql/i ){ + + #crap, this isn't working + #push @sql,"ALTER TABLE $table MODIFY reason ". $column->line($dbh); + warn "WARNING: reason table upgrade not yet supported for mysql, sorry"; + + } else { die "watchu talkin' 'bout, Willis? (unsupported database type)"; } foreach (@sql) { my $sth = $dbh->prepare($_) or die $dbh->errstr; - $sth->execute or die $dbh->errstr; + $sth->execute or die $sth->errstr; } } }