databaseChangeLog:
  - logicalFilePath: db-changelog-000432-ra-context-param-table.yaml
  - changeSet:
      id: 'tag-pre-000432'
      author: appian
      tagDatabase:
        tag: 'pre-000432'
  - changeSet:
      id: '000432.1.0'
      author: appian
      changes:
        comment: Create ra_context_param table
        createTable:
          tableName: ra_context_param
          columns:
            - column:
                name: id
                type: ${longType}
                autoIncrement: ${autoIncrement}
                constraints:
                  primaryKey: true
                  nullable: false
            - column:
                name: related_action_id
                type: ${longType}
                constraints:
                  nullable: false
            - column:
                name: parameter_name
                type: ${shortStringType}
                constraints:
                  nullable: false
            - column:
                name: parameter_type
                type: ${integerType}
                constraints:
                  nullable: false
            - column:
                name: value
                type: ${expressionStringType}
            - column:
                name: value_type
                type: ${integerType}
            - column:
                name: value_config_type
                type: ${byteType}
                valueNumeric: 0
                defaultValueNumeric: 0
                constraints:
                  nullable: false
  - changeSet:
      id: '000432.2.0'
      author: appian
      changes:
        comment: Add foreign key between ra_context_param table and related action cfg
        addForeignKeyConstraint:
          constraintName: ra_context_param_ra_id_fk
          baseTableName: ra_context_param
          baseColumnNames: related_action_id
          referencedTableName: record_related_action_cfg
          referencedColumnNames: id
  - changeSet:
      id: '000432.2.1'
      author: appian
      comment: Add index on ra_context_param.related_action_id
      changes:
        createIndex:
          columns:
            - column:
                name: related_action_id
          indexName: ra_context_param_ra_id_idx
          tableName: ra_context_param
          unique: false
  - changeSet:
      id: '000432.3.0'
      author: appian
      comment: Create a new sequence to generate the primary key values for the ra_context_param table
      changes:
        preConditions:
          onFail: MARK_RAN
          changeLogPropertyDefined:
            property: createSequence
            value: true
        createSequence:
          sequenceName: ra_context_param_sq
