From 5d2988e3bd92007d9590abb397b06a5fe83446f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 25 Sep 2020 09:12:26 +0200 Subject: [PATCH] Drop fk constraints on locks table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/private/Repair/Owncloud/SaveAccountsTableData.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/private/Repair/Owncloud/SaveAccountsTableData.php b/lib/private/Repair/Owncloud/SaveAccountsTableData.php index 6ca46934d7..89c331a7d7 100644 --- a/lib/private/Repair/Owncloud/SaveAccountsTableData.php +++ b/lib/private/Repair/Owncloud/SaveAccountsTableData.php @@ -78,6 +78,15 @@ class SaveAccountsTableData implements IRepairStep { $numUsers = $this->runStep($offset); } + // oc_persistent_locks will be removed later on anyways so we can just drop and ignore any foreign key constraints here + $tableName = $this->config->getSystemValue('dbtableprefix', 'oc_') . 'persistent_locks'; + $schema = $this->db->createSchema(); + $table = $schema->getTable($tableName); + foreach ($table->getForeignKeys() as $foreignKey) { + $table->removeForeignKey($foreignKey->getName()); + } + $this->db->migrateToSchema($schema); + // Remove the table if ($this->hasForeignKeyOnPersistentLocks) { $this->db->dropTable('persistent_locks');