"Fossies" - the Fresh Open Source Software Archive

Member "mattermost-server-6.0.1/db/migrations/mysql/000001_create_teams.down.sql" (18 Oct 2021, 1652 Bytes) of package /linux/www/mattermost-server-6.0.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PL/SQL source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 SET @preparedStatement = (SELECT IF(
    2     (
    3         SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
    4         WHERE table_name = 'Teams'
    5         AND table_schema = DATABASE()
    6         AND column_name = 'AllowOpenInvite'
    7     ) > 0,
    8     'ALTER TABLE Teams DROP COLUMN AllowOpenInvite;',
    9     'SELECT 1'
   10 ));
   11 
   12 PREPARE alterIfExists FROM @preparedStatement;
   13 EXECUTE alterIfExists;
   14 DEALLOCATE PREPARE alterIfExists;
   15 
   16 SET @preparedStatement = (SELECT IF(
   17     (
   18         SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
   19         WHERE table_name = 'Teams'
   20         AND table_schema = DATABASE()
   21         AND column_name = 'LastTeamIconUpdate'
   22     ) > 0,
   23     'ALTER TABLE Teams DROP COLUMN LastTeamIconUpdate;',
   24     'SELECT 1'
   25 ));
   26 
   27 PREPARE alterIfExists FROM @preparedStatement;
   28 EXECUTE alterIfExists;
   29 DEALLOCATE PREPARE alterIfExists;
   30 
   31 SET @preparedStatement = (SELECT IF(
   32     (
   33         SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
   34         WHERE table_name = 'Teams'
   35         AND table_schema = DATABASE()
   36         AND column_name = 'Description'
   37     ) > 0,
   38     'ALTER TABLE Teams DROP COLUMN Description;',
   39     'SELECT 1'
   40 ));
   41 
   42 PREPARE alterIfExists FROM @preparedStatement;
   43 EXECUTE alterIfExists;
   44 DEALLOCATE PREPARE alterIfExists;
   45 
   46 SET @preparedStatement = (SELECT IF(
   47     (
   48         SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
   49         WHERE table_name = 'Teams'
   50         AND table_schema = DATABASE()
   51         AND column_name = 'GroupConstrained'
   52     ) > 0,
   53     'ALTER TABLE Teams DROP COLUMN GroupConstrained;',
   54     'SELECT 1'
   55 ));
   56 
   57 PREPARE alterIfExists FROM @preparedStatement;
   58 EXECUTE alterIfExists;
   59 DEALLOCATE PREPARE alterIfExists;
   60 
   61 DROP TABLE IF EXISTS Teams;