databaseChangeLog:
  - changeSet:
      id: 129-add-component-table
      author: aisvoran
      changes:
        - createTable:
            tableName: component_definition
            columns:
              - column:
                  name: id
                  type: VARCHAR(255)
                  constraints:
                    primaryKey: true
                    primaryKeyName: component_definition_pkey
                    nullable: false
              - column:
                  name: dossier_template_id
                  type: VARCHAR(255)
                  constraints:
                    nullable: false
              - column:
                  name: technical_name
                  type: VARCHAR(255)
                  constraints:
                    nullable: false
              - column:
                  name: display_name
                  type: VARCHAR(255)
                  constraints:
                    nullable: false
              - column:
                  name: description
                  type: TEXT
              - column:
                  name: rank
                  type: INTEGER
              - column:
                  name: soft_delete_time
                  type: TIMESTAMP
        - addUniqueConstraint:
            columnNames: technical_name, dossier_template_id
            tableName: component_definition
            constraintName: uq_component_definition_technical_name_template
        - addForeignKeyConstraint:
            baseTableName: component_definition
            baseColumnNames: dossier_template_id
            constraintName: fk_component_definition_dossier_template
            referencedTableName: dossier_template
            referencedColumnNames: id
            onDelete: CASCADE
            onUpdate: CASCADE