Added index on SidebarCategories table (#20045)
```release-note NONE ``` Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e284b811df
Коммит
84dbf894ea
14
db/migrations/mysql/000087_sidebar_categories_index.down.sql
Обычный файл
14
db/migrations/mysql/000087_sidebar_categories_index.down.sql
Обычный файл
@@ -0,0 +1,14 @@
|
||||
SET @preparedStatement = (SELECT IF(
|
||||
(
|
||||
SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE table_name = 'SidebarCategories'
|
||||
AND table_schema = DATABASE()
|
||||
AND index_name = 'idx_sidebarcategories_userid_teamid'
|
||||
) > 0,
|
||||
'DROP INDEX idx_sidebarcategories_userid_teamid on SidebarCategories;',
|
||||
'SELECT 1;'
|
||||
));
|
||||
|
||||
PREPARE removeIndexIfExists FROM @preparedStatement;
|
||||
EXECUTE removeIndexIfExists;
|
||||
DEALLOCATE PREPARE removeIndexIfExists;
|
||||
14
db/migrations/mysql/000087_sidebar_categories_index.up.sql
Обычный файл
14
db/migrations/mysql/000087_sidebar_categories_index.up.sql
Обычный файл
@@ -0,0 +1,14 @@
|
||||
SET @preparedStatement = (SELECT IF(
|
||||
(
|
||||
SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE table_name = 'SidebarCategories'
|
||||
AND table_schema = DATABASE()
|
||||
AND index_name = 'idx_sidebarcategories_userid_teamid'
|
||||
) > 0,
|
||||
'SELECT 1;',
|
||||
'CREATE INDEX idx_sidebarcategories_userid_teamid on SidebarCategories(UserId, TeamId) LOCK=NONE;'
|
||||
));
|
||||
|
||||
PREPARE createIndexIfNotExists FROM @preparedStatement;
|
||||
EXECUTE createIndexIfNotExists;
|
||||
DEALLOCATE PREPARE createIndexIfNotExists;
|
||||
@@ -0,0 +1 @@
|
||||
DROP INDEX IF exists idx_sidebarcategories_userid_teamid;
|
||||
@@ -0,0 +1 @@
|
||||
CREATE INDEX IF NOT EXISTS idx_sidebarcategories_userid_teamid on sidebarcategories (userid, teamid);
|
||||
Ссылка в новой задаче
Block a user