summaryrefslogtreecommitdiff
path: root/FS/FS/reason.pm
diff options
context:
space:
mode:
authorivan <ivan>2008-02-11 02:37:58 +0000
committerivan <ivan>2008-02-11 02:37:58 +0000
commitc9f77472c8fe6f06e381faecf4f53c8cb8036602 (patch)
tree5b8cdbd4df4aa04ef5dec25b60c4d89c95c1da7b /FS/FS/reason.pm
parent5b2d5b6114e3127afac0af44f40d009fc18ec8de (diff)
upgrading reason table not quite working with mysql, hopefully no old installs need this, new ones should be fine hopefully
Diffstat (limited to 'FS/FS/reason.pm')
-rw-r--r--FS/FS/reason.pm13
1 files changed, 10 insertions, 3 deletions
diff --git a/FS/FS/reason.pm b/FS/FS/reason.pm
index 5ce1848..5311ec5 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,9 +147,14 @@ 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)";
}