diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2021-11-04 15:38:01 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2021-12-14 10:58:30 +0100 |
commit | 94b5b21e8c7afd6aeb56c489c29b9faf1dbd3e5c (patch) | |
tree | 60aecefc4828334ea1995a558c86f0c2dafd34f6 | |
parent | 8367bda4454d07613126bbcc512f8fc568d79149 (diff) | |
download | nextcloud-server-94b5b21e8c7afd6aeb56c489c29b9faf1dbd3e5c.tar.gz nextcloud-server-94b5b21e8c7afd6aeb56c489c29b9faf1dbd3e5c.zip |
Fixes in migration step
We cannot set ldap_dn_hash column as notnull because it is empty for
existing users before postSchemaChange is called
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r-- | apps/user_ldap/lib/Migration/Version1130Date20211102154716.php | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php b/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php index 198a79ef095..829e0d5a58c 100644 --- a/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php +++ b/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php @@ -45,9 +45,8 @@ class Version1130Date20211102154716 extends SimpleMigrationStep { $table = $schema->getTable($tableName); if (!$table->hasColumn('ldap_dn_hash')) { $table->addColumn('ldap_dn_hash', Types::STRING, [ - 'notnull' => true, + 'notnull' => false, 'length' => 64, - 'default' => '', ]); $changeSchema = true; } @@ -74,7 +73,7 @@ class Version1130Date20211102154716 extends SimpleMigrationStep { $table->addUniqueIndex(['ldap_dn_hash'], 'ldap_group_dn_hashes'); $changeSchema = true; } - if ($table->getPrimaryKeyColumns() !== ['owncloud_name']) { + if (!$table->hasPrimaryKey() || ($table->getPrimaryKeyColumns() !== ['owncloud_name'])) { $table->dropPrimaryKey(); $table->setPrimaryKey(['owncloud_name']); $changeSchema = true; |