Преглед изворни кода

Replace index (with composite)

Visman пре 1 година
родитељ
комит
4eb77bbc1f
2 измењених фајлова са 3 додато и 1 уклоњено
  1. 1 1
      app/Models/Pages/Admin/Install.php
  2. 2 0
      app/Models/Pages/Admin/Update.php

+ 1 - 1
app/Models/Pages/Admin/Install.php

@@ -1052,7 +1052,7 @@ class Install extends Admin
             ],
             'PRIMARY KEY' => ['id'],
             'INDEXES' => [
-                'forum_id_idx'      => ['forum_id'],
+                'multi_2_idx'       => ['forum_id', 'sticky', 'last_post'],
                 'last_post_idx'     => ['last_post'],
                 'first_post_id_idx' => ['first_post_id'],
                 'multi_1_idx'       => ['moved_to', 'forum_id', 'num_replies', 'last_post'],

+ 2 - 0
app/Models/Pages/Admin/Update.php

@@ -886,8 +886,10 @@ class Update extends Admin
 
         $this->c->DB->addIndex('::posts', 'editor_id_idx', ['editor_id']);
 
+        $this->c->DB->dropIndex('::topics', 'forum_id_idx');
         $this->c->DB->dropIndex('::topics', 'moved_to_idx');
         $this->c->DB->addIndex('::topics', 'multi_1_idx', ['moved_to', 'forum_id', 'num_replies', 'last_post']);
+        $this->c->DB->addIndex('::topics', 'multi_2_idx', ['forum_id', 'sticky', 'last_post']);
 
         return null;
     }