databaseChangeLog:
  - logicalFilePath: db-changelog-000419-create-portal-alert-email-grp-table.yaml
  - changeSet:
      author: appian
      id: tag-pre-000419
      tagDatabase:
        tag: 'pre-000419'
  - changeSet:
      author: appian
      id: '000419.1.0'
      comment: Create portal_alert_email_grp table
      changes:
        createTable:
          tableName: portal_alert_email_grp
          columns:
            - column:
                name: id
                type: ${longType}
                autoIncrement: ${autoIncrement}
                constraints:
                  nullable: false
                  primaryKey: true
            - column:
                name: portal_id
                type: ${longType}
                constraints:
                  nullable: false
            - column:
                name: grp_uuid
                type: ${uuidType}
                constraints:
                  nullable: false
  - changeSet:
      author: appian
      id: '000419.1.1'
      comment: Add FK from portal_alert_email_grp.portal_id to portal.id
      changes:
        addForeignKeyConstraint:
          constraintName: portal_alert_email_grp_pid_fk
          baseTableName: portal_alert_email_grp
          baseColumnNames: portal_id
          referencedTableName: portal
          referencedColumnNames: id
  - changeSet:
      id: '000419.1.2'
      author: appian
      comment: Add index on portal_alert_email_grp.portal_id
      changes:
        createIndex:
          columns:
            - column:
                name: portal_id
          indexName: portal_alert_email_grp_pid_idx
          tableName: portal_alert_email_grp
          unique: false
  - changeSet:
      id: '000419.1.3'
      author: appian
      comment: Add sequence to provide primary key values for the portal_alert_email_grp table
      preConditions:
        onFail: MARK_RAN
        changeLogPropertyDefined:
          property: createSequence
          value: true
      createSequence:
        sequenceName: portal_alert_email_grp_sq
