]> source.dussan.org Git - nextcloud-server.git/commitdiff
Drop fk constraints on locks table
authorJulius Härtl <jus@bitgrid.net>
Fri, 25 Sep 2020 07:12:26 +0000 (09:12 +0200)
committerJulius Härtl <jus@bitgrid.net>
Mon, 14 Dec 2020 10:12:49 +0000 (11:12 +0100)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
lib/private/Repair/Owncloud/SaveAccountsTableData.php

index 6ca46934d71685cbdfa084366f1fb4ff2b769788..89c331a7d711efed40356ddb4ff56b1b76dfb4f4 100644 (file)
@@ -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');