Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

4.0 KB
Raw Blame
## Metabot Slack integration migrations

databaseChangeLog:
  - logicalFilePath: migrations/060_update_migrations.yaml
  - changeSet:
      id: v60.2026-03-03T21:28:30
      author: noahmoss
      comment: Create the Slack Metabot instance
      preConditions:
        - onFail: MARK_RAN
        - sqlCheck:
            expectedResult: 0
            sql: >-
              SELECT COUNT(*) FROM metabot WHERE entity_id = 'slackbotmetabotmetabo';
      rollback:
        - sql:
            sql: >-
              DELETE FROM metabot WHERE entity_id = 'slackbotmetabotmetabo';
      changes:
        - sql:
            sql: >-
              INSERT INTO metabot (
                  name
                  , description
                  , entity_id
                  , created_at
                  , updated_at
              ) VALUES (
                  'Slack Metabot'
                  , 'Metabot instance for Slack users.'
                  , 'slackbotmetabotmetabo'
                  , now()
                  , now()
              );

  - changeSet:
      id: v60.2026-03-04T10:00:00
      author: sloansparger
      comment: Add slack_msg_id to metabot_message for tracking Slack message IDs
      changes:
        - addColumn:
            tableName: metabot_message
            columns:
              - column:
                  name: slack_msg_id
                  type: varchar(255)
                  remarks: Slack message ID (ts) for correlating with Slack thread history
                  constraints:
                    nullable: true

  - changeSet:
      id: v60.2026-03-06T18:05:00
      author: noahmoss
      comment: Add channel_id to metabot_message for Slack response correlation
      changes:
        - addColumn:
            tableName: metabot_message
            columns:
              - column:
                  name: channel_id
                  type: varchar(255)
                  remarks: Slack channel ID for correlating Slack responses
                  constraints:
                    nullable: true

  - changeSet:
      id: v60.2026-03-06T18:06:00
      author: noahmoss
      comment: Index on metabot_message.channel_id and slack_msg_id
      changes:
        - createIndex:
            indexName: idx_metabot_message_channel_id_slack_msg_id
            tableName: metabot_message
            columns:
              - column:
                  name: channel_id
              - column:
                  name: slack_msg_id
      rollback:
        - dropIndex:
            tableName: metabot_message
            indexName: idx_metabot_message_channel_id_slack_msg_id

  - changeSet:
      id: v60.2026-03-06T22:30:00
      author: noahmoss
      comment: Add deleted_at to metabot_message for Slack response removal
      changes:
        - addColumn:
            tableName: metabot_message
            columns:
              - column:
                  name: deleted_at
                  type: ${timestamp_type}
                  remarks: Soft delete timestamp for removed Slack metabot responses
                  constraints:
                    nullable: true

  - changeSet:
      id: v60.2026-03-06T22:31:00
      author: noahmoss
      comment: Add deleted_by_user_id to metabot_message for Slack response removal
      changes:
        - addColumn:
            tableName: metabot_message
            columns:
              - column:
                  name: deleted_by_user_id
                  type: integer
                  remarks: Metabase user ID who removed the Slack metabot response
                  constraints:
                    nullable: true

  - changeSet:
      id: v60.2026-03-06T22:39:30
      author: noahmoss
      comment: Add user_id to metabot_message to track which user each message belongs to
      changes:
        - addColumn:
            tableName: metabot_message
            columns:
              - column:
                  name: user_id
                  type: integer
                  remarks: Metabase user ID associated with this message
                  constraints:
                    nullable: true