X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2Fbin%2Ffreeside-upgrade;h=ab2384453350c5940b622f286723676c58c8ca91;hb=e726556cd5e5f45fc1b4ebc055102b1bf3da270d;hp=b2cd3db49cfce9af6e67f7cb5b3472a5d9dae3e2;hpb=dc0f1291d98ac8f8d5b5da9465ab282f36c90034;p=freeside.git diff --git a/FS/bin/freeside-upgrade b/FS/bin/freeside-upgrade index b2cd3db49..ab2384453 100755 --- a/FS/bin/freeside-upgrade +++ b/FS/bin/freeside-upgrade @@ -94,10 +94,19 @@ if ( dbdef->table('areacode') and } if ( dbdef->table('upgrade_journal') ) { - push @bugfix, "SELECT SETVAL( 'upgrade_journal_upgradenum_seq', - ( SELECT MAX(upgradenum) FROM upgrade_journal ) - ) - "; + if ( driver_name =~ /^Pg/i ) { + push @bugfix, " + SELECT SETVAL( 'upgrade_journal_upgradenum_seq', + ( SELECT MAX(upgradenum) FROM upgrade_journal ) + ) + "; + #MySQL can't do this in a statement so have to do it manually + #} elsif ( driver_name =~ /^mysql/i ) { + # push @bugfix, " + # ALTER TABLE upgrade_journal AUTO_INCREMENT = + # ( ( SELECT MAX(upgradenum) FROM upgrade_journal ) + 1 ) + # "; + } } if ( $DRY_RUN ) { @@ -172,6 +181,9 @@ unless ( driver_name =~ /^mysql/i ) { if ( $opt_c ) { + #can always add it back for 4.x->4.x if we need it + die "FATAL: -c removed: cdr / h_cdr upgrade is required for 4.x\n"; + @statements = grep { $_ !~ /^ *ALTER +TABLE +(h_)?cdr /i } @statements; @@ -304,7 +316,7 @@ print "\n" if $DRY_RUN; if ( $dbh->{Driver}->{Name} =~ /^mysql/i && ! $opt_s ) { - foreach my $table (qw( svc_acct svc_phone )) { + foreach my $table (qw( svc_acct svc_phone cust_main_county )) { my $sth = $dbh->prepare( "SELECT COUNT(*) FROM duplicate_lock WHERE lockname = '$table'" @@ -421,7 +433,7 @@ sub dbdef_create { # reverse engineer the schema from the DB and save to file } sub usage { - die "Usage:\n freeside-upgrade [ -d ] [ -q | -v ] [ -r ] [ -c ] [ -s ] [ -j ] [ -a ] user\n"; + die "Usage:\n freeside-upgrade [ -d ] [ -q | -v ] [ -r ] [ -s ] [ -j ] [ -a ] user\n"; } =head1 NAME @@ -430,7 +442,7 @@ freeside-upgrade - Upgrades database schema for new freeside verisons. =head1 SYNOPSIS - freeside-upgrade [ -d ] [ -q | -v ] [ -r ] [ -c ] [ -s ] [ -j ] [ -a ] + freeside-upgrade [ -d ] [ -q | -v ] [ -r ] [ -s ] [ -j ] [ -a ] =head1 DESCRIPTION @@ -455,20 +467,17 @@ Also performs other upgrade functions: [ -v ]: Run verbosely, sending debugging information to STDERR. This is the current default. - [ -s ]: Schema changes only. Useful for Pg/slony slaves where the data + [ -s ]: Schema changes only. Used to be useful for Pg/slony slaves where the + data changes would be replicated from the Pg/slony master (current + native Pg replication replicates schema changes to slaves + automatically). [ -r ]: Skip sqlradius updates. Useful for occassions where the sqlradius databases may be inaccessible. - [ -c ]: Skip cdr and h_cdr updates. - - changes will be replicated from the Pg/slony master. - - [ -j ]: Run certain upgrades asychronously from the job queue. Currently - used only for the 2.x -> 3.x cust_location, cust_pay and part_pkg - upgrades. This may cause odd behavior before the upgrade is - complete, so it's recommended only for very large cust_main, cust_pay - and/or part_pkg tables that take too long to upgrade. + [ -j ]: Run certain upgrades asychronously from the job queue. Recommended + for very large cust_main or part_pkg tables that take too long to + upgrade. [ -a ]: Run schema changes in parallel (Pg only). DBIx::DBSchema minimum version 0.41 recommended. Recommended only for large databases and