databaseChangeLog:
  - logicalFilePath: db-changelog-000431-add-site-page-inputs.yaml
  - changeSet:
      author: appian
      id: 'tag-pre-000431'
      tagDatabase:
        tag: 'pre-000431'
  - changeSet:
      author: appian
      id: '000431.1.0'
      comment: Create site_page_input table
      changes:
        - createTable:
            tableName: site_page_input
            columns:
              - column:
                  name: id
                  type: ${longType}
                  autoIncrement: ${autoIncrement}
                  constraints:
                    nullable: false
                    primaryKey: true
              - column:
                  name: uuid
                  type: ${uuidType}
                  constraints:
                    nullable: false
                    unique: true
                    uniqueConstraintName: site_page_input_uuid_uc
              - column:
                  name: site_page_id
                  type: ${longType}
                  constraints:
                    nullable: true
              - column:
                  name: input_name
                  type: ${shortStringType}
                  constraints:
                    nullable: false
              - column:
                  name: allow_query_parameter
                  type: ${booleanType}
                  constraints:
                    nullable: false
              - column:
                  name: default_value_expr
                  type: ${expressionStringType}
                  constraints:
                    nullable: true
              - column:
                  name: order_idx
                  type: ${integerType}
                  defaultValue: 0
                  valueNumeric: 0
                  constraints:
                    nullable: true
              - column:
                  name: url_parameter_name
                  type: ${shortStringType}
                  constraints:
                    nullable: false
  - changeSet:
      id: '000431.1.1'
      comment: A sequence to provide primary key values for the site_page_input table
      author: appian
      changes:
        preConditions:
          onFail: MARK_RAN
          changeLogPropertyDefined:
            property: createSequence
            value: true
        createSequence:
          sequenceName: site_page_input_sq
  - changeSet:
      id: '000431.1.2'
      author: appian
      comment: Add FK for site_page_input.site_page_id to site_page.id
      addForeignKeyConstraint:
        constraintName: site_page_input_page_id_fk
        baseTableName: site_page_input
        baseColumnNames: site_page_id
        referencedTableName: site_page
        referencedColumnNames: id
  - changeSet:
      id: '000431.1.3'
      author: appian
      comment: Add index on site_page_input.site_page_id
      changes:
        createIndex:
          columns:
            - column:
                name: site_page_id
          indexName: site_page_input_page_id_idx
          tableName: site_page_input
          unique: false
  - changeSet:
      author: appian
      id: '000431.2.0'
      comment: Add are_url_params_encrypted flag
      addColumn:
        tableName: site_page
        columns:
          - column:
              name: are_url_params_encrypted
              type: ${booleanType}
              defaultValueBoolean: true
              constraints:
                nullable: false
  - changeSet:
      author: appian
      id: '000431.2.1'
      comment: Remove the are_url_params_encrypted default value for future new rows
      dropDefaultValue:
        tableName: site_page
        columnName: are_url_params_encrypted
        columnDataType: ${booleanType}
