db.changelog.20191108-environment-artifact-constraint.yml Maven / Gradle / Ivy
databaseChangeLog:
- changeSet:
id: create-environment-artifact-constraint-table
author: asher
changes:
- createTable:
tableName: environment_artifact_constraint
columns:
- column:
name: environment_uid
type: char(26)
constraints:
nullable: false
- column:
name: artifact_version
type: varchar(255)
constraints:
nullable: false
- column:
name: constraint_type
type: varchar(255)
constraints:
nullable: false
- column:
name: created_at
type: timestamp
defaultValueComputed: CURRENT_TIMESTAMP
constraints:
nullable: false
- column:
name: status
type: int
constraints:
nullable: true
- column:
name: judged_by
type: varchar(255)
constraints:
nullable: true
- column:
name: judged_at
type: timestamp
constraints:
nullable: true
- column:
name: comment
type: varchar(255)
constraints:
nullable: true
- column:
name: json
type: longtext
constraints:
nullable: true
- changeSet:
id: mysql-environment-artifact-constraint-status-enum
author: asher
changes:
- sql:
dbms: mysql
sql: ALTER TABLE `environment_artifact_constraint` MODIFY COLUMN `status` ENUM("PENDING", "PASS", "FAIL", "OVERRIDE_PASS", "OVERRIDE_FAIL") NOT NULL DEFAULT "PENDING"
- changeSet:
id: create-environment-artifact-constraint-indices
author: asher
changes:
- addPrimaryKey:
tableName: environment_artifact_constraint
constraintName: constraint_pk
columnNames: environment_uid, artifact_version, constraint_type
- createIndex:
tableName: environment_artifact_constraint
indexName: environment_artifact_constraint_judged_at_idx
columns:
- column:
name: judged_at
- changeSet:
id: mysql-environment-artifact-constraint-status-not-enum
author: asher
changes:
- sql:
dbms: mysql
sql: ALTER TABLE `environment_artifact_constraint` MODIFY COLUMN `status` VARCHAR(64)
- changeSet:
id: mysql-environment-artifact-constraint-attributes
author: asher
changes:
- renameColumn:
tableName: environment_artifact_constraint
oldColumnName: json
newColumnName: attributes
columnDataType: longtext
# work around for https://liquibase.jira.com/browse/CORE-2111 to get the new uid column
# in the first position, since it's going to be the primary key
- changeSet:
id: mysql-envconstraint-add-uid
author: asher
changes:
- sql:
dbms: mysql
sql: alter table `environment_artifact_constraint` add column `uid` char(26) not null first
- changeSet:
id: envconstraint-add-uid
author: asher
changes:
- dropPrimaryKey:
tableName: environment_artifact_constraint
constraintName: constraint_pk
dropIndex: true
- renameColumn:
tableName: environment_artifact_constraint
columnDataType: varchar(255)
oldColumnName: constraint_type
newColumnName: type
- addPrimaryKey:
tableName: environment_artifact_constraint
constraintName: constraint_pk
columnNames: uid
- addUniqueConstraint:
tableName: environment_artifact_constraint
constraintName: constraint_pk
columnNames: environment_uid, type, artifact_version
- changeSet:
id: create-current-constraint-table
author: asher
changes:
- createTable:
tableName: current_constraint
columns:
- column:
name: application
type: varchar(255)
constraints:
nullable: false
- column:
name: environment_uid
type: char(26)
constraints:
nullable: false
- column:
name: type
type: varchar(255)
constraints:
nullable: false
- column:
name: constraint_uid
type: char(26)
constraints:
nullable: false
- addPrimaryKey:
tableName: current_constraint
constraintName: current_constraint_pk
columnNames: application, environment_uid, type
- createIndex:
tableName: current_constraint
indexName: current_constraint_uid_idx
columns:
- column:
name: constraint_uid
- changeSet:
id: wider-envconstraint-columns
author: asher
changes:
- modifyDataType:
tableName: environment_artifact_constraint
columnName: judged_by
newDataType: varchar(512)
- modifyDataType:
tableName: environment_artifact_constraint
columnName: comment
newDataType: varchar(1024)