summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/Migration
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2022-03-03 21:19:11 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2022-03-03 21:26:18 +0100
commitf3668f27483435af4e107219df684b810b9d839d (patch)
tree0078e342c764245c3ecf39156961145504779865 /apps/user_ldap/lib/Migration
parent787f4f02b361eec1eddf08709905ed4b5d250a48 (diff)
downloadnextcloud-server-f3668f27483435af4e107219df684b810b9d839d.tar.gz
nextcloud-server-f3668f27483435af4e107219df684b810b9d839d.zip
be conservative when reading from fresh created column
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib/Migration')
-rw-r--r--apps/user_ldap/lib/Migration/Version1130Date20211102154716.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php b/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php
index 27f5f5ce504..03106b635bb 100644
--- a/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php
+++ b/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php
@@ -43,6 +43,8 @@ class Version1130Date20211102154716 extends SimpleMigrationStep {
private $dbc;
/** @var LoggerInterface */
private $logger;
+ /** @var string[] */
+ private $hashColumnAddedToTables = [];
public function __construct(IDBConnection $dbc, LoggerInterface $logger) {
$this->dbc = $dbc;
@@ -89,6 +91,7 @@ class Version1130Date20211102154716 extends SimpleMigrationStep {
'length' => 64,
]);
$changeSchema = true;
+ $this->hashColumnAddedToTables[] = $tableName;
}
$column = $table->getColumn('ldap_dn');
if ($tableName === 'ldap_user_mapping') {
@@ -177,9 +180,16 @@ class Version1130Date20211102154716 extends SimpleMigrationStep {
protected function getSelectQuery(string $table): IQueryBuilder {
$qb = $this->dbc->getQueryBuilder();
- $qb->select('owncloud_name', 'ldap_dn', 'ldap_dn_hash')
- ->from($table)
- ->where($qb->expr()->isNull('ldap_dn_hash'));
+ $qb->select('owncloud_name', 'ldap_dn')
+ ->from($table);
+
+ // when added we may run into risk that it's read from a DB node
+ // where the column is not present. Then the where clause is also
+ // not necessary since all rows qualify.
+ if (!in_array($table, $this->hashColumnAddedToTables, true)) {
+ $qb->where($qb->expr()->isNull('ldap_dn_hash'));
+ }
+
return $qb;
}