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-11-23 09:20:29 +0100 |
commit | c4d8bd9c0532f4acaf5b0d8e625dff875fad43f4 (patch) | |
tree | c449c0c35ec405e840d9e195051c964751330d0e /apps/user_ldap | |
parent | d4c49a3a60fac3c3e0b17386b8be8436ae1a1520 (diff) | |
download | nextcloud-server-c4d8bd9c0532f4acaf5b0d8e625dff875fad43f4.tar.gz nextcloud-server-c4d8bd9c0532f4acaf5b0d8e625dff875fad43f4.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>
Diffstat (limited to 'apps/user_ldap')
-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; |