databaseChangeLog:
  - logicalFilePath: db-changelog-000484-drop-uk-and-client-id-name-change-third-party-oauth2-config.yaml
  - changeSet:
      author: appian
      id: tag-pre-000484
      tagDatabase:
        tag: 'pre-000484'
  - changeSet:
      author: appian
      id: '000484.1.0'
      comment: Drop third_party_oauth2_config table to add again
      changes:
        - dropTable:
            tableName: third_party_oauth2_config
            cascadeConstraints: true
  - changeSet:
      id: '000484.1.1'
      author: appian
      comment: Drop third_party_oauth2_config Sequence
      preConditions:
        onFail: MARK_RAN
        changeLogPropertyDefined:
          property: dropSequence
          value: true
      dropSequence:
        sequenceName: third_party_oauth2_config_sq
  - changeSet:
      author: appian
      id: '000484.2.0'
      comment: Create third_party_oauth2_config table
      createTable:
        tableName: third_party_oauth2_config
        columns:
          - column:
              name: id
              type: ${longType}
              autoIncrement: ${autoIncrement}
              constraints:
                nullable: false
                primaryKey: true
          - column:
              name: description
              type: ${shortStringType}
              constraints:
                nullable: false
          - column:
              name: client_id_mapping
              type: ${shortStringType}
              constraints:
                nullable: false
          - column:
              name: client_id
              type: ${shortStringType}
              constraints:
                nullable: false
          - column:
              name: jwk_set_source_type
              type: ${stringType}(20)
              constraints:
                nullable: false
          - column:
              name: jwk_set_file_id
              type: ${shortStringType}
              constraints:
                nullable: true
          - column:
              name: jwk_set_uri
              type: ${mediumStringType}
              constraints:
                nullable: true
          - column:
              name: issuer
              type: ${shortStringType}
              constraints:
                nullable: false
          - column:
              name: audience
              type: ${shortStringType}
              constraints:
                nullable: false
          - column:
              name: svc_acc_id
              type: ${longType}
              constraints:
                nullable: false
          - column:
              name: last_used_ts
              type: ${longType}
              constraints:
                nullable: true
          - column:
              name: is_active
              type: ${booleanType}
              defaultValueBoolean: true
              constraints:
                nullable: false
          - column:
              name: is_revoked
              type: ${booleanType}
              defaultValueBoolean: false
              constraints:
                nullable: false
          - column:
              name: jwk_last_update_date
              type: ${longType}
              constraints:
                nullable: true
          - column:
              name: created_by
              type: ${longType}
              constraints:
                nullable: false
          - column:
              name: created_ts
              type: ${longType}
              constraints:
                nullable: false
          - column:
              name: updated_by
              type: ${longType}
              constraints:
                nullable: false
          - column:
              name: updated_ts
              type: ${longType}
              constraints:
                nullable: false
  - changeSet:
      id: '000484.3.0'
      author: appian
      changes:
        preConditions:
          onFail: MARK_RAN
          changeLogPropertyDefined:
            property: createSequence
            value: true
        createSequence:
          sequenceName: tp_oauth2_cfg_sq
  - changeSet:
      id: '000484.4.0'
      author: appian
      comment: FK from third_party_oauth2_config.created_by to usr.id
      addForeignKeyConstraint:
        constraintName: tp_oauth2_cfg_created_by_fk
        baseTableName: third_party_oauth2_config
        baseColumnNames: created_by
        referencedTableName: usr
        referencedColumnNames: id
  - changeSet:
      id: '000484.4.1'
      author: appian
      comment: FK from third_party_oauth2_config.updated_by to usr.id
      addForeignKeyConstraint:
        constraintName: tp_oauth2_cfg_updated_by_fk
        baseTableName: third_party_oauth2_config
        baseColumnNames: updated_by
        referencedTableName: usr
        referencedColumnNames: id
  - changeSet:
      id: '000484.4.2'
      author: appian
      comment: FK from third_party_oauth2_config.svc_acc_id to usr.id
      addForeignKeyConstraint:
        constraintName: tp_oauth2_cfg_svc_acc_id_fk
        baseTableName: third_party_oauth2_config
        baseColumnNames: svc_acc_id
        referencedTableName: usr
        referencedColumnNames: id
  - changeSet:
      id: '000484.5.0'
      author: appian
      changes:
        comment: Add index on created_by
        createIndex:
          columns:
            - column:
                name: created_by
          indexName: tp_oauth2_cfg_created_by_idx
          tableName: third_party_oauth2_config
          unique: false
  - changeSet:
      id: '000484.5.1'
      author: appian
      changes:
        comment: Add index on updated_by
        createIndex:
          columns:
            - column:
                name: updated_by
          indexName: tp_oauth2_cfg_updated_by_idx
          tableName: third_party_oauth2_config
          unique: false
  - changeSet:
      id: '000484.5.2'
      author: appian
      changes:
        comment: Add index on svc_acc_id
        createIndex:
          columns:
            - column:
                name: svc_acc_id
          indexName: tp_oauth2_cfg_svc_acc_id_idx
          tableName: third_party_oauth2_config
          unique: false

