All Downloads are FREE. Search and download functionalities are using the official Maven repository.

db.changelog.20201116-foreign-keys.yml Maven / Gradle / Ivy

There is a newer version: 1.4.1
Show newest version
databaseChangeLog:
- changeSet:
    id: foreign-keys-on-artifact_last_checked
    author: fletch
    changes:
    - sql:
        sql: delete from artifact_last_checked where not exists (select 1 from delivery_artifact where artifact_last_checked.artifact_uid = delivery_artifact.uid)
    - addForeignKeyConstraint:
        baseTableName: artifact_last_checked
        baseColumnNames: artifact_uid
        constraintName: fk_artifact_last_checked_delivery_artifact
        referencedTableName: delivery_artifact
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
- changeSet:
    id: foreign-keys-on-current_constraint
    author: fletch
    changes:
    - addForeignKeyConstraint:
        baseTableName: current_constraint
        baseColumnNames: environment_uid
        constraintName: fk_current_constraint_environment
        referencedTableName: environment
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
    - addForeignKeyConstraint:
        baseTableName: current_constraint
        baseColumnNames: constraint_uid
        constraintName: fk_current_constraint_environment_artifact_constraint
        referencedTableName: environment_artifact_constraint
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
- changeSet:
    id: foreign-keys-on-delivery_config_artifact
    author: fletch
    changes:
    - sql:
        sql: delete from delivery_config_artifact where not exists (select 1 from delivery_config where delivery_config_artifact.delivery_config_uid = delivery_config.uid)
    - sql:
        sql: delete from delivery_config_artifact where not exists (select 1 from delivery_artifact where delivery_config_artifact.artifact_uid = delivery_artifact.uid)
    - addForeignKeyConstraint:
        baseTableName: delivery_config_artifact
        baseColumnNames: delivery_config_uid
        constraintName: fk_delivery_config_artifact_delivery_config
        referencedTableName: delivery_config
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
    - addForeignKeyConstraint:
        baseTableName: delivery_config_artifact
        baseColumnNames: artifact_uid
        constraintName: fk_delivery_config_artifact_delivery_artifact
        referencedTableName: delivery_artifact
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
- changeSet:
    id: foreign-keys-on-delivery_config_last_checked
    author: fletch
    changes:
    - sql:
        sql: delete from delivery_config_last_checked where not exists (select 1 from delivery_config where delivery_config_last_checked.delivery_config_uid = delivery_config.uid)
    - addForeignKeyConstraint:
        baseTableName: delivery_config_last_checked
        baseColumnNames: delivery_config_uid
        constraintName: fk_delivery_config_last_checked_delivery_config
        referencedTableName: delivery_config
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
- changeSet:
    id: foreign-keys-on-environment
    author: fletch
    changes:
    - addForeignKeyConstraint:
        baseTableName: environment
        baseColumnNames: delivery_config_uid
        constraintName: fk_environment_delivery_config
        referencedTableName: delivery_config
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
- changeSet:
    id: foreign-keys-on-environment_artifact_constraint
    author: fletch
    changes:
    - sql:
        sql: delete from environment_artifact_constraint where uid = ''
    - addForeignKeyConstraint:
        baseTableName: environment_artifact_constraint
        baseColumnNames: environment_uid
        constraintName: fk_environment_artifact_constraint_environment
        referencedTableName: environment
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
- changeSet:
    id: foreign-keys-on-environment_artifact_pin
    author: fletch
    changes:
    - addForeignKeyConstraint:
        baseTableName: environment_artifact_pin
        baseColumnNames: environment_uid
        constraintName: fk_environment_artifact_pin_environment
        referencedTableName: environment
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
    - addForeignKeyConstraint:
        baseTableName: environment_artifact_pin
        baseColumnNames: artifact_uid
        constraintName: fk_environment_artifact_pin_delivery_artifact
        referencedTableName: delivery_artifact
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
- changeSet:
    id: foreign-keys-on-environment_artifact_queued_approval
    author: fletch
    changes:
    - sql:
        sql: delete from environment_artifact_queued_approval where not exists (select 1 from environment where environment.uid = environment_artifact_queued_approval.environment_uid)
    - addForeignKeyConstraint:
        baseTableName: environment_artifact_queued_approval
        baseColumnNames: environment_uid
        constraintName: fk_environment_artifact_queued_approval_environment
        referencedTableName: environment
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
- changeSet:
    id: foreign-keys-on-environment_artifact_versions
    author: fletch
    changes:
    - sql:
        sql: delete from environment_artifact_versions where not exists (select 1 from delivery_artifact where delivery_artifact.uid = environment_artifact_versions.artifact_uid)
    - addForeignKeyConstraint:
        baseTableName: environment_artifact_versions
        baseColumnNames: environment_uid
        constraintName: fk_environment_artifact_versions_environment
        referencedTableName: environment
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
    - addForeignKeyConstraint:
        baseTableName: environment_artifact_versions
        baseColumnNames: artifact_uid
        constraintName: fk_environment_artifact_versions_delivery_artifact
        referencedTableName: delivery_artifact
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
- changeSet:
    id: foreign-keys-on-environment_artifact_veto
    author: fletch
    changes:
    - sql:
        sql: delete from environment_artifact_veto where not exists (select 1 from environment where environment.uid = environment_artifact_veto.environment_uid)
    - sql:
        sql: delete from environment_artifact_veto where not exists (select 1 from delivery_artifact where delivery_artifact.uid = environment_artifact_veto.artifact_uid)
    - addForeignKeyConstraint:
        baseTableName: environment_artifact_veto
        baseColumnNames: environment_uid
        constraintName: fk_environment_artifact_veto_environment
        referencedTableName: environment
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
    - addForeignKeyConstraint:
        baseTableName: environment_artifact_veto
        baseColumnNames: artifact_uid
        constraintName: fk_environment_artifact_veto_delivery_artifact
        referencedTableName: delivery_artifact
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
- changeSet:
    id: foreign-keys-on-environment_resource
    author: fletch
    changes:
    - addForeignKeyConstraint:
        baseTableName: environment_resource
        baseColumnNames: environment_uid
        constraintName: fk_environment_resource_environment
        referencedTableName: environment
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
    - addForeignKeyConstraint:
        baseTableName: environment_resource
        baseColumnNames: resource_uid
        constraintName: fk_environment_resource_resource
        referencedTableName: resource
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
- changeSet:
    id: foreign-keys-on-resource_last_checked
    author: fletch
    changes:
    - sql:
        sql: delete from resource_last_checked where not exists (select 1 from resource where resource.uid = resource_last_checked.resource_uid)
    - addForeignKeyConstraint:
        baseTableName: resource_last_checked
        baseColumnNames: resource_uid
        constraintName: fk_resource_last_checked_resource
        referencedTableName: resource
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
- changeSet:
    id: resource_uid-on-unhappy_veto
    author: fletch
    changes:
    - addColumn:
        tableName: unhappy_veto
        columns:
        - column:
            name: resource_uid
            type: char(26)
    - modifySql:
        dbms: mysql
        append:
          value: " first"
- changeSet:
    id: foreign-keys-on-unhappy_veto
    author: fletch
    changes:
    - sql:
        sql: delete from unhappy_veto where not exists (select 1 from resource where resource.id = unhappy_veto.resource_id)
    - sql:
        sql: update unhappy_veto set resource_uid = (select uid from resource where id = unhappy_veto.resource_id)
    - addNotNullConstraint:
        tableName: unhappy_veto
        columnName: resource_uid
        columnDataType: char(26)
    - addForeignKeyConstraint:
        baseTableName: unhappy_veto
        baseColumnNames: resource_uid
        constraintName: fk_unhappy_veto_resource
        referencedTableName: resource
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
    - dropColumn:
        tableName: unhappy_veto
        columnName: resource_id
    - dropColumn:
        tableName: unhappy_veto
        columnName: application
- changeSet:
    id: primary-key-on-unhappy_veto
    author: fletch
    changes:
    - addPrimaryKey:
        tableName: unhappy_veto
        columnNames: resource_uid
        constraintName: pk_unhappy_veto
- changeSet:
    id: resource_uid-on-unhealthy
    author: fletch
    changes:
    - addColumn:
        tableName: unhealthy
        columns:
        - column:
            name: resource_uid
            type: char(26)
    - modifySql:
        dbms: mysql
        append:
          value: " first"
- changeSet:
    id: foreign-keys-on-unhealthy
    author: fletch
    changes:
    - sql:
        sql: delete from unhealthy where not exists (select 1 from resource where resource.id = unhealthy.resource_id)
    - sql:
        sql: update unhealthy set resource_uid = (select uid from resource where id = unhealthy.resource_id)
    - addNotNullConstraint:
        tableName: unhealthy
        columnName: resource_uid
        columnDataType: char(26)
    - addForeignKeyConstraint:
        baseTableName: unhealthy
        baseColumnNames: resource_uid
        constraintName: fk_unhealthy_resource
        referencedTableName: resource
        referencedColumnNames: uid
        referencesUniqueColumn: true
        onDelete: CASCADE
    - dropColumn:
        tableName: unhealthy
        columnName: resource_id
- changeSet:
    id: primary-key-on-unhealthy
    author: fletch
    changes:
    - addPrimaryKey:
        tableName: unhealthy
        columnNames: resource_uid
        constraintName: pk_unhealthy




© 2015 - 2024 Weber Informatics LLC | Privacy Policy