Skip to content

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

4.4 KB
Raw Blame
## TODO: quick description of what feature/bug this migration is for

databaseChangeLog:
  - logicalFilePath: migrations/060_update_migrations.yaml
  - changeSet:
      id: v60.2026-03-06T12:00:00
      author: bcm
      comment: Create source_replacement_run table to track async source replacement executions
      changes:
        - createTable:
            tableName: source_replacement_run
            remarks: Table to track source replacement executions and their status
            columns:
              - column:
                  name: id
                  type: int
                  remarks: Unique ID
                  autoIncrement: true
                  constraints:
                    primaryKey: true
                    nullable: false
              - column:
                  name: source_entity_type
                  type: varchar(50)
                  remarks: "Type of the source entity (card or table)"
                  constraints:
                    nullable: false
              - column:
                  name: source_entity_id
                  type: int
                  remarks: "ID of the source entity"
                  constraints:
                    nullable: false
              - column:
                  name: target_entity_type
                  type: varchar(50)
                  remarks: "Type of the target entity (card or table)"
                  constraints:
                    nullable: false
              - column:
                  name: target_entity_id
                  type: int
                  remarks: "ID of the target entity"
                  constraints:
                    nullable: false
              - column:
                  name: status
                  type: varchar(50)
                  remarks: "Current status (started, succeeded, failed, canceled, timeout)"
                  constraints:
                    nullable: false
              - column:
                  name: is_active
                  type: ${boolean.type}
                  remarks: "True only for currently running replacements, null for completed"
                  constraints:
                    nullable: true
              - column:
                  name: progress
                  type: float
                  remarks: "Progress from 0.0 to 1.0"
                  constraints:
                    nullable: true
              - column:
                  name: message
                  type: ${text.type}
                  remarks: "Human-readable message; may contain error info"
                  constraints:
                    nullable: true
              - column:
                  name: user_id
                  type: int
                  remarks: "User who initiated the replacement"
                  constraints:
                    nullable: true
              - column:
                  name: start_time
                  type: ${timestamp_type}
                  remarks: "When the replacement started"
                  defaultValueComputed: current_timestamp
                  constraints:
                    nullable: false
              - column:
                  name: end_time
                  type: ${timestamp_type}
                  remarks: "When the replacement completed (null if still running)"
                  constraints:
                    nullable: true

  - changeSet:
      id: v60.2026-03-06T12:00:01
      author: bcm
      comment: Enforce at most one active source replacement run cluster-wide
      changes:
        - addUniqueConstraint:
            tableName: source_replacement_run
            constraintName: idx_unique_active_source_replacement_run
            columnNames: is_active

  - changeSet:
      id: v60.2026-03-06T12:00:02
      author: bcm
      comment: Add index on source_replacement_run.user_id
      changes:
        - createIndex:
            tableName: source_replacement_run
            indexName: idx_source_replacement_run_user_id
            columns:
              - column:
                  name: user_id

  - changeSet:
      id: v60.2026-03-06T12:00:03
      author: bcm
      comment: Add foreign key on source_replacement_run(user_id)
      changes:
        - addForeignKeyConstraint:
            baseTableName: source_replacement_run
            baseColumnNames: user_id
            referencedTableName: core_user
            referencedColumnNames: id
            constraintName: fk_source_replacement_run_user_id