databaseChangeLog:
  - logicalFilePath: db-changelog-000360-add-field-template-type-column.yaml
  - changeSet:
      author: appian
      id: tag-pre-000360
      tagDatabase:
        tag: 'pre-000360'
  - changeSet:
      author: appian
      id: '000360.1.0'
      comment: Create column for field_template_type
      addColumn:
        tableName: record_source_fields
        columns:
          - column:
              name: field_template_type
              type: ${byteType}
              defaultValueNumeric: 0
              valueNumeric: 0
              constraints:
                nullable: false
  - changeSet:
      author: appian
      id: '000360.1.1'
      comment: Update field_template_type to AGGREGATION (1) for existing query time custom fields
      changes:
        update:
          tableName: record_source_fields
          column:
            name: field_template_type
            value: 1
          where: field_calculation_type = '2'
