]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(db): remove redundant indices in properties 43339/head
authorJohannes Merkel <mail@johannesgge.de>
Sun, 4 Feb 2024 22:27:39 +0000 (23:27 +0100)
committerJohannes Merkel <mail@johannesgge.de>
Sun, 18 Feb 2024 20:02:42 +0000 (21:02 +0100)
Signed-off-by: Johannes Merkel <mail@johannesgge.de>
core/Migrations/Version13000Date20170718121200.php
core/Migrations/Version29000Date20240131122720.php [new file with mode: 0644]
lib/composer/composer/autoload_classmap.php
lib/composer/composer/autoload_static.php

index da83b0732d8a5ece0718e0777e849a7bd4858611..b9f7827809bbd7c8cdca3abdf5f902c593f2a12f 100644 (file)
@@ -360,7 +360,8 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
                                'notnull' => true,
                        ]);
                        $table->setPrimaryKey(['id']);
-                       $table->addIndex(['userid'], 'property_index');
+                       // Dropped in Version29000Date20240131122720 because property_index is redundant with properties_path_index
+                       // $table->addIndex(['userid'], 'property_index');
                        $table->addIndex(['userid', 'propertypath'], 'properties_path_index');
                        $table->addIndex(['propertypath'], 'properties_pathonly_index');
                } else {
diff --git a/core/Migrations/Version29000Date20240131122720.php b/core/Migrations/Version29000Date20240131122720.php
new file mode 100644 (file)
index 0000000..0273fd7
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2024 Johannes Merkel <mail@johannesgge.de>
+ *
+ * @author Johannes Merkel <mail@johannesgge.de>
+ *
+ * @license AGPL-3.0-or-later
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OC\Core\Migrations;
+
+use Closure;
+use OCP\DB\ISchemaWrapper;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+
+/**
+ *
+ */
+class Version29000Date20240131122720 extends SimpleMigrationStep {
+
+       /**
+        * @param IOutput $output
+        * @param Closure(): ISchemaWrapper $schemaClosure
+        * @param array $options
+        * @return null|ISchemaWrapper
+        */
+       public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
+               /** @var ISchemaWrapper $schema */
+               $schema = $schemaClosure();
+
+               $tableProperties = $schema->getTable('properties');
+
+               if ($tableProperties->hasIndex('property_index') &&
+                       $tableProperties->hasIndex('properties_path_index')) {
+
+                       $tableProperties->dropIndex('property_index');
+               }
+
+               return $schema;
+       }
+}
index c027075d1605a1f017f06eec855c7ecf1526d5d1..9c3bf0f7e9a1353475928f874460e494b845057d 100644 (file)
@@ -1244,6 +1244,7 @@ return array(
     'OC\\Core\\Migrations\\Version29000Date20231213104850' => $baseDir . '/core/Migrations/Version29000Date20231213104850.php',
     'OC\\Core\\Migrations\\Version29000Date20240124132201' => $baseDir . '/core/Migrations/Version29000Date20240124132201.php',
     'OC\\Core\\Migrations\\Version29000Date20240124132202' => $baseDir . '/core/Migrations/Version29000Date20240124132202.php',
+    'OC\\Core\\Migrations\\Version29000Date20240131122720' => $baseDir . '/core/Migrations/Version29000Date20240131122720.php',
     'OC\\Core\\Notification\\CoreNotifier' => $baseDir . '/core/Notification/CoreNotifier.php',
     'OC\\Core\\Service\\LoginFlowV2Service' => $baseDir . '/core/Service/LoginFlowV2Service.php',
     'OC\\DB\\Adapter' => $baseDir . '/lib/private/DB/Adapter.php',
index 238b667b5f4f3b246d871425a3df5d425a5ecb11..b222594af754b625df0989b5c40969c3436152fc 100644 (file)
@@ -1277,6 +1277,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
         'OC\\Core\\Migrations\\Version29000Date20231213104850' => __DIR__ . '/../../..' . '/core/Migrations/Version29000Date20231213104850.php',
         'OC\\Core\\Migrations\\Version29000Date20240124132201' => __DIR__ . '/../../..' . '/core/Migrations/Version29000Date20240124132201.php',
         'OC\\Core\\Migrations\\Version29000Date20240124132202' => __DIR__ . '/../../..' . '/core/Migrations/Version29000Date20240124132202.php',
+        'OC\\Core\\Migrations\\Version29000Date20240131122720' => __DIR__ . '/../../..' . '/core/Migrations/Version29000Date20240131122720.php',
         'OC\\Core\\Notification\\CoreNotifier' => __DIR__ . '/../../..' . '/core/Notification/CoreNotifier.php',
         'OC\\Core\\Service\\LoginFlowV2Service' => __DIR__ . '/../../..' . '/core/Service/LoginFlowV2Service.php',
         'OC\\DB\\Adapter' => __DIR__ . '/../../..' . '/lib/private/DB/Adapter.php',