db.changelog.20210419-actually-no-environment-features-per-version.yml Maven / Gradle / Ivy
databaseChangeLog:
- changeSet:
id: actually-no-environment-features-per-version
author: fletch
changes:
- addColumn:
tableName: environment
columns:
- column:
name: constraints
type: json
constraints:
nullable: false
- column:
name: verifications
type: json
constraints:
nullable: false
- column:
name: notifications
type: json
constraints:
nullable: false
- sql:
sql: |
update environment
join latest_environment
on environment.uid = latest_environment.uid
set environment.constraints = latest_environment.constraints
, environment.verifications = latest_environment.verifications
, environment.notifications = latest_environment.notifications;
- dropView:
viewName: latest_environment
- dropColumn:
tableName: environment_version
columns:
- column:
name: constraints
- column:
name: verifications
- column:
name: notifications
- createView:
viewName: latest_environment
selectQuery: |
select uid, delivery_config_uid, name, version, constraints, notifications, verifications
from environment
join environment_version
on environment.uid = environment_version.environment_uid
and environment_version.version = (
select max(ev2.version)
from environment_version ev2
where environment.uid = ev2.environment_uid
);