Skip to content

Commit

Permalink
Merge pull request #42504 from nextcloud/bugfix/setup-primary
Browse files Browse the repository at this point in the history
fix: Avoid using replicas during setup
  • Loading branch information
juliusknorr authored Dec 28, 2023
2 parents 2362a96 + 81b089c commit 7812a02
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/private/Setup/AbstractDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@ protected function connect(array $configOverwrite = []): Connection {
}
$connectionParams['host'] = $host;
}

$connectionParams = array_merge($connectionParams, ['primary' => $connectionParams, 'replica' => [$connectionParams]], $configOverwrite);
$connectionParams = array_merge($connectionParams, $configOverwrite);
$connectionParams = array_merge($connectionParams, ['primary' => $connectionParams, 'replica' => [$connectionParams]]);
$cf = new ConnectionFactory($this->config);
return $cf->getConnection($this->config->getValue('dbtype', 'sqlite'), $connectionParams);
$connection = $cf->getConnection($this->config->getValue('dbtype', 'sqlite'), $connectionParams);
$connection->ensureConnectedToPrimary();
return $connection;
}

/**
Expand Down

0 comments on commit 7812a02

Please sign in to comment.