Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2022-02-02 20:26:31 +0300
committerArthur Schiwon <blizzz@arthur-schiwon.de>2022-02-15 15:23:24 +0300
commitbf31badac453b6fe77758b6376fc965b3b007116 (patch)
tree931baf4e56a225f9570ad84ae0623e483031ebf7
parent6813b3814800b2e94ef71f173fe95bf884bd81f4 (diff)
allow to re-run migration step when backup DB is already created
- to heal incomplete states from broken upgrades Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
-rw-r--r--apps/user_ldap/lib/Migration/Version1130Date20211102154716.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php b/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php
index 335a310fd75..82afe1d725d 100644
--- a/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php
+++ b/apps/user_ldap/lib/Migration/Version1130Date20211102154716.php
@@ -56,6 +56,17 @@ class Version1130Date20211102154716 extends SimpleMigrationStep {
foreach (['ldap_user_mapping', 'ldap_group_mapping'] as $tableName) {
$this->processDuplicateUUIDs($tableName);
}
+
+ /** @var ISchemaWrapper $schema */
+ $schema = $schemaClosure();
+ if ($schema->hasTable('ldap_group_mapping_backup')) {
+ // Previous upgrades of a broken release might have left an incomplete
+ // ldap_group_mapping_backup table. No need to recreate, but it
+ // should be empty.
+ // TRUNCATE is not available from Query Builder, but faster than DELETE FROM.
+ $sql = $this->dbc->getDatabasePlatform()->getTruncateTableSQL('ldap_group_mapping_backup', false);
+ $this->dbc->executeStatement($sql);
+ }
}
/**
@@ -97,7 +108,7 @@ class Version1130Date20211102154716 extends SimpleMigrationStep {
$table->addUniqueIndex(['directory_uuid'], 'ldap_user_directory_uuid');
$changeSchema = true;
}
- } else {
+ } else if (!$schema->hasTable('ldap_group_mapping_backup')) {
// We need to copy the table twice to be able to change primary key, prepare the backup table
$table2 = $schema->createTable('ldap_group_mapping_backup');
$table2->addColumn('ldap_dn', Types::STRING, [