databaseChangeLog:
  - logicalFilePath: db-changelog-000562-add-insight-to-mining-scope-kpis-fk.yaml
  - changeSet:
      author: appian
      id: 'tag-pre-000562'
      tagDatabase:
        tag: 'pre-000562'
  - changeSet:
      id: '000562.1.0'
      author: appian
      comment: Add scope_id and kpi_id columns
      changes:
        - addColumn:
            tableName: mining_insight
            columns:
              - column:
                  name: mining_scope_id
                  type: ${longtype}
              - column:
                  name: mining_kpi_id
                  type: ${longtype}
  - changeSet:
      author: appian
      id: "000562.1.1"
      comment: Add FKs for mining_insight
      changes:
        - addForeignKeyConstraint:
            constraintName: mining_insight_scope_kpi_fk
            baseTableName: mining_insight
            baseColumnNames: mining_scope_id, mining_kpi_id
            referencedTableName: mining_scope_kpis
            referencedColumnNames: mining_scope_id, mining_kpi_id
  - changeSet:
      id: '000562.1.2'
      author: appian
      comment: Add index on mining_insight.mining_scope_id
      changes:
        - createIndex:
            tableName: mining_insight
            columns:
              - column:
                  name: mining_scope_id
            indexName: mining_insight_scope_id_idx
  - changeSet:
      id: '000562.1.3'
      author: appian
      comment: Add index on mining_insight.mining_kpi_id
      changes:
        - createIndex:
            tableName: mining_insight
            columns:
              - column:
                  name: mining_kpi_id
            indexName: mining_insight_kpi_id_idx
