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 $version = shift;
zmDbDisconnect();
my ( $host, $portOrSocket ) = ( $Config{ZM_DB_HOST} =~ /^([^:]+)(?::(.+))?$/ );
my $command = 'mysql';
if ( defined($portOrSocket) ) {
@ -966,6 +968,8 @@ sub patchDB {
die( "Command '$command' exited with status: $status\n" );
}
print( "\nDatabase successfully upgraded to version $version.\n" );
$dbh = zmDbConnect();
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 $res = $sth->execute( $version ) or die( "Can't execute: ".$sth->errstr() );