databaseChangeLog:
  - logicalFilePath: db-changelog-000517-add-process-mining-statistic-kpis.yaml
  - changeSet:
      author: appian
      id: 'tag-pre-000517'
      tagDatabase:
        tag: 'pre-000517'
  - changeSet:
      author: appian
      id: '000517.1.0'
      comment: Create table for mining_kpi_type_statistic
      changes:
        - createTable:
            tableName: mining_kpi_type_statistic
            columns:
              - column:
                  name: id
                  type: ${longType}
                  autoIncrement: ${autoIncrement}
                  constraints:
                    nullable: false
                    primaryKey: true
              - column:
                  name: kpi_type_id
                  type: ${longType}
                  constraints:
                    nullable: false
              - column:
                  name: measure_option
                  type: ${byteType}
                  constraints:
                    nullable: false
              - column:
                  name: unit
                  type: ${shortStringType}
  - changeSet:
      author: appian
      id: '000517.1.1'
      comment: Create index for mining_kpi_type_statistic
      changes:
        - createIndex:
            indexName: kpi_stat_type_kpi_type_id_idx
            tableName: mining_kpi_type_statistic
            columns:
              - column:
                  name: kpi_type_id
  - changeSet:
      author: appian
      id: '000517.1.2'
      comment: Add fk for base table mining_kpi_type_statistic
      changes:
        - addForeignKeyConstraint:
            constraintName: kpi_stat_type_kpi_type_id_fk
            baseTableName: mining_kpi_type_statistic
            baseColumnNames: kpi_type_id
            referencedTableName: mining_kpi_type
            referencedColumnNames: id
            onDelete: CASCADE
  - changeSet:
      author: appian
      id: '000517.1.3'
      comment: Create sequence for mining_kpi_type_statistic
      changes:
        preConditions:
          onFail: MARK_RAN
          changeLogPropertyDefined:
            property: createSequence
            value: true
        createSequence:
          sequenceName: mining_kpi_type_statistic_sq
