Must disconnect and reconnect before calling update script

This commit is contained in:
Isaac Connor 2018-01-19 16:32:26 -05:00
parent e372a490fa
commit 2682686063
1 changed files with 4 additions and 0 deletions

View File

@ -932,6 +932,8 @@ sub patchDB {
my $dbh = shift; my $dbh = shift;
my $version = shift; my $version = shift;
zmDbDisconnect();
my ( $host, $portOrSocket ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ ); my ( $host, $portOrSocket ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ );
my $command = 'mysql'; my $command = 'mysql';
if ( defined($portOrSocket) ) { if ( defined($portOrSocket) ) {
@ -966,6 +968,8 @@ sub patchDB {
die( "Command '$command' exited with status: $status\n" ); die( "Command '$command' exited with status: $status\n" );
} }
print( "\nDatabase successfully upgraded to version $version.\n" ); print( "\nDatabase successfully upgraded to version $version.\n" );
$dbh = zmDbConnect();
my $sql = "update Config set Value = ? where Name = 'ZM_DYN_DB_VERSION'"; my $sql = "update Config set Value = ? where Name = 'ZM_DYN_DB_VERSION'";
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
my $res = $sth->execute( $version ) or die( "Can't execute: ".$sth->errstr() ); my $res = $sth->execute( $version ) or die( "Can't execute: ".$sth->errstr() );