mirror of
https://github.com/hanzoai/team.git
synced 2026-10-30 14:49:35 +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
80 lines
2.1 KiB
SQL
80 lines
2.1 KiB
SQL
SET @preparedStatement = (SELECT IF(
|
|
(
|
|
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
|
|
WHERE table_name = 'Users'
|
|
AND table_schema = DATABASE()
|
|
AND column_name = 'Props'
|
|
AND column_type != 'JSON'
|
|
) > 0,
|
|
'ALTER TABLE Users MODIFY COLUMN Props JSON;',
|
|
'SELECT 1'
|
|
));
|
|
|
|
PREPARE alterIfExists FROM @preparedStatement;
|
|
EXECUTE alterIfExists;
|
|
DEALLOCATE PREPARE alterIfExists;
|
|
|
|
SET @preparedStatement = (SELECT IF(
|
|
(
|
|
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
|
|
WHERE table_name = 'Users'
|
|
AND table_schema = DATABASE()
|
|
AND column_name = 'NotifyProps'
|
|
AND column_type != 'JSON'
|
|
) > 0,
|
|
'ALTER TABLE Users MODIFY COLUMN NotifyProps JSON;',
|
|
'SELECT 1'
|
|
));
|
|
|
|
PREPARE alterIfExists FROM @preparedStatement;
|
|
EXECUTE alterIfExists;
|
|
DEALLOCATE PREPARE alterIfExists;
|
|
|
|
SET @preparedStatement = (SELECT IF(
|
|
(
|
|
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
|
|
WHERE table_name = 'Users'
|
|
AND table_schema = DATABASE()
|
|
AND column_name = 'Timezone'
|
|
AND column_default IS NOT NULL
|
|
) > 0,
|
|
'ALTER TABLE Users ALTER Timezone DROP DEFAULT;',
|
|
'SELECT 1'
|
|
));
|
|
|
|
PREPARE alterIfExists FROM @preparedStatement;
|
|
EXECUTE alterIfExists;
|
|
DEALLOCATE PREPARE alterIfExists;
|
|
|
|
SET @preparedStatement = (SELECT IF(
|
|
(
|
|
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
|
|
WHERE table_name = 'Users'
|
|
AND table_schema = DATABASE()
|
|
AND column_name = 'Timezone'
|
|
AND column_type != 'JSON'
|
|
) > 0,
|
|
'ALTER TABLE Users MODIFY COLUMN Timezone JSON;',
|
|
'SELECT 1'
|
|
));
|
|
|
|
PREPARE alterIfExists FROM @preparedStatement;
|
|
EXECUTE alterIfExists;
|
|
DEALLOCATE PREPARE alterIfExists;
|
|
|
|
SET @preparedStatement = (SELECT IF(
|
|
(
|
|
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
|
|
WHERE table_name = 'Users'
|
|
AND table_schema = DATABASE()
|
|
AND column_name = 'Roles'
|
|
AND column_type != 'text'
|
|
) > 0,
|
|
'ALTER TABLE Users MODIFY COLUMN Roles text;',
|
|
'SELECT 1'
|
|
));
|
|
|
|
PREPARE alterIfExists FROM @preparedStatement;
|
|
EXECUTE alterIfExists;
|
|
DEALLOCATE PREPARE alterIfExists;
|