db.changelog.20210616-create-dismissible-notifications.yml Maven / Gradle / Ivy
databaseChangeLog:
- changeSet:
id: create-dismissible-notification
author: lpollo
changes:
- createTable:
tableName: dismissible_notification
columns:
- column:
name: uid
type: char(26)
constraints:
primaryKey: true
- column:
name: json
type: json
constraints:
nullable: true
- sql:
sql: |
alter table dismissible_notification
add column triggered_at datetime(3) generated always as (str_to_date(json->>'$.triggeredAt', '%Y-%m-%dT%T.%fZ'))
after uid;
- sql:
sql: |
alter table dismissible_notification
add column level varchar(10) generated always as (json->>'$.level')
after triggered_at;
- sql:
sql: |
alter table dismissible_notification
add column is_active boolean generated always as (if(json->>'$.isActive' = 'true', 1 , 0))
after level;
- sql:
sql: |
alter table dismissible_notification
add column application varchar(255) generated always as (json->>'$.application')
after is_active;
- sql:
sql: |
alter table dismissible_notification
add column environment varchar(255) generated always as (json->>'$.environment')
after application;
- sql:
sql: |
alter table dismissible_notification
add column link varchar(1000) generated always as (json->>'$.link')
after environment;
- sql:
sql: |
alter table dismissible_notification
add column triggered_by varchar(255) generated always as (json->>'$.triggeredBy')
after link;
- sql:
sql: |
alter table dismissible_notification
add column dismissed_by varchar(255) generated always as (json->>'$.dismissedBy')
after link;
- sql:
sql: |
alter table dismissible_notification
add column dismissed_at datetime(3) generated always as (str_to_date(json->>'$.dismissedAt', '%Y-%m-%dT%T.%fZ'))
after dismissed_by;
- createIndex:
indexName: dismissible_notification_application_idx
tableName: dismissible_notification
columns:
- column:
name: application
- createIndex:
indexName: dismissible_notification_uid_triggered_at_is_active_idx
tableName: dismissible_notification
columns:
- column:
name: uid
- column:
name: triggered_at
- column:
name: is_active