mirror of
https://github.com/hanzoai/team.git
synced 2026-11-01 07:55:31 +00:00
Combines the following repositories into one: https://github.com/mattermost/mattermost-server https://github.com/mattermost/mattermost-webapp https://github.com/mattermost/focalboard https://github.com/mattermost/mattermost-plugin-playbooks
45 lines
1.3 KiB
SQL
45 lines
1.3 KiB
SQL
SET @preparedStatement = (SELECT IF(
|
|
(
|
|
SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS
|
|
WHERE table_name = 'Channels'
|
|
AND table_schema = DATABASE()
|
|
AND index_name = 'idx_channels_team_id'
|
|
) > 0,
|
|
'SELECT 1',
|
|
'CREATE INDEX idx_channels_team_id ON Channels(TeamId);'
|
|
));
|
|
|
|
PREPARE createIndexIfNotExists FROM @preparedStatement;
|
|
EXECUTE createIndexIfNotExists;
|
|
DEALLOCATE PREPARE createIndexIfNotExists;
|
|
|
|
SET @preparedStatement = (SELECT IF(
|
|
(
|
|
SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS
|
|
WHERE table_name = 'Channels'
|
|
AND table_schema = DATABASE()
|
|
AND index_name = 'idx_channels_team_id_type'
|
|
) > 0,
|
|
'DROP INDEX idx_channels_team_id_type ON Channels;',
|
|
'SELECT 1'
|
|
));
|
|
|
|
PREPARE removeIndexIfExists FROM @preparedStatement;
|
|
EXECUTE removeIndexIfExists;
|
|
DEALLOCATE PREPARE removeIndexIfExists;
|
|
|
|
SET @preparedStatement = (SELECT IF(
|
|
(
|
|
SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS
|
|
WHERE table_name = 'Channels'
|
|
AND table_schema = DATABASE()
|
|
AND index_name = 'idx_channels_team_id_display_name'
|
|
) > 0,
|
|
'DROP INDEX idx_channels_team_id_display_name ON Channels;',
|
|
'SELECT 1'
|
|
));
|
|
|
|
PREPARE removeIndexIfExists FROM @preparedStatement;
|
|
EXECUTE removeIndexIfExists;
|
|
DEALLOCATE PREPARE removeIndexIfExists;
|