db/migrations: drop nextsyncat and description columns from shared remotes (#25064)

This commit is contained in:
Ibrahim Serdar Acikgoz
2023-10-31 15:25:16 +03:00
committed by GitHub
parent a4ece51391
commit 1cd439f8e0
5 changed files with 37 additions and 0 deletions

View File

@@ -224,6 +224,8 @@ channels/db/migrations/mysql/000112_rework_desktop_tokens.down.sql
channels/db/migrations/mysql/000112_rework_desktop_tokens.up.sql
channels/db/migrations/mysql/000113_create_retentionidsfordeletion_table.down.sql
channels/db/migrations/mysql/000113_create_retentionidsfordeletion_table.up.sql
channels/db/migrations/mysql/000114_sharedchannelremotes_drop_nextsyncat_description.down.sql
channels/db/migrations/mysql/000114_sharedchannelremotes_drop_nextsyncat_description.up.sql
channels/db/migrations/postgres/000001_create_teams.down.sql
channels/db/migrations/postgres/000001_create_teams.up.sql
channels/db/migrations/postgres/000002_create_team_members.down.sql
@@ -448,3 +450,5 @@ channels/db/migrations/postgres/000112_rework_desktop_tokens.down.sql
channels/db/migrations/postgres/000112_rework_desktop_tokens.up.sql
channels/db/migrations/postgres/000113_create_retentionidsfordeletion_table.down.sql
channels/db/migrations/postgres/000113_create_retentionidsfordeletion_table.up.sql
channels/db/migrations/postgres/000114_sharedchannelremotes_drop_nextsyncat_description.down.sql
channels/db/migrations/postgres/000114_sharedchannelremotes_drop_nextsyncat_description.up.sql

View File

@@ -0,0 +1 @@
-- It is intentionally to not have rollback for sharedchannelremotes_drop_nextsyncat_description

View File

@@ -0,0 +1,29 @@
SET @preparedStatement = (SELECT IF(
(
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'SharedChannelRemotes'
AND table_schema = DATABASE()
AND column_name = 'NextSyncAt'
) > 0,
'ALTER TABLE SharedChannelRemotes DROP COLUMN NextSyncAt;',
'SELECT 1'
));
PREPARE alterIfExists FROM @preparedStatement;
EXECUTE alterIfExists;
DEALLOCATE PREPARE alterIfExists;
SET @preparedStatement = (SELECT IF(
(
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'SharedChannelRemotes'
AND table_schema = DATABASE()
AND column_name = 'Description'
) > 0,
'ALTER TABLE SharedChannelRemotes DROP COLUMN Description;',
'SELECT 1'
));
PREPARE alterIfExists FROM @preparedStatement;
EXECUTE alterIfExists;
DEALLOCATE PREPARE alterIfExists;

View File

@@ -0,0 +1 @@
-- It is intentionally to not have rollback for sharedchannelremotes_drop_nextsyncat_description

View File

@@ -0,0 +1,2 @@
ALTER TABLE sharedchannelremotes DROP COLUMN IF EXISTS nextsyncat;
ALTER TABLE sharedchannelremotes DROP COLUMN IF EXISTS description;