From c0088505f5f9632a99e35b10ddde4bca19fb08c4 Mon Sep 17 00:00:00 2001 From: Mariko Medlock Date: Tue, 6 Jun 2023 11:04:22 -0400 Subject: [PATCH 1/2] Revert changeset modifications. --- service/src/main/resources/db/changelog.xml | 13 -- .../db/changesets/20230410_schema_reset.yaml | 132 +++++++++--------- ...0530_avoid_postgres_specific_features.yaml | 28 ++-- 3 files changed, 80 insertions(+), 93 deletions(-) diff --git a/service/src/main/resources/db/changelog.xml b/service/src/main/resources/db/changelog.xml index 28b4ce572..4e6f19740 100644 --- a/service/src/main/resources/db/changelog.xml +++ b/service/src/main/resources/db/changelog.xml @@ -1,18 +1,5 @@ - - - - - - - - - - - - - diff --git a/service/src/main/resources/db/changesets/20230410_schema_reset.yaml b/service/src/main/resources/db/changesets/20230410_schema_reset.yaml index 854fb245f..31b291be0 100644 --- a/service/src/main/resources/db/changesets/20230410_schema_reset.yaml +++ b/service/src/main/resources/db/changesets/20230410_schema_reset.yaml @@ -1,31 +1,31 @@ databaseChangeLog: - changeSet: id: schema_reset - author: marikomedlock, chenchalsubraveti + author: marikomedlock changes: - createTable: tableName: study columns: - column: name: id - type: ${id.type} + type: text constraints: primaryKey: true nullable: false unique: true - column: name: display_name - type: ${text.type} + type: text constraints: nullable: true - column: name: description - type: ${text.type} + type: text constraints: nullable: true - column: name: properties - type: ${jsonb.type} + type: jsonb constraints: nullable: true - column: @@ -36,7 +36,7 @@ databaseChangeLog: defaultValueComputed: now() - column: name: created_by - type: ${text.type} + type: text constraints: nullable: false - column: @@ -47,7 +47,7 @@ databaseChangeLog: defaultValueComputed: now() - column: name: last_modified_by - type: ${text.type} + type: text constraints: nullable: false @@ -56,14 +56,14 @@ databaseChangeLog: columns: - column: name: id - type: ${id.type} + type: text constraints: primaryKey: true nullable: false unique: true - column: name: study_id - type: ${id.type} + type: text constraints: references: study(id) foreignKeyName: fk_cs_s @@ -72,22 +72,22 @@ databaseChangeLog: remarks: Deleting a study will cascade to delete the concept sets contained in it - column: name: underlay - type: ${text.type} + type: text constraints: nullable: false - column: name: entity - type: ${text.type} + type: text constraints: nullable: false - column: name: display_name - type: ${text.type} + type: text constraints: nullable: true - column: name: description - type: ${text.type} + type: text constraints: nullable: true - column: @@ -98,7 +98,7 @@ databaseChangeLog: defaultValueComputed: now() - column: name: created_by - type: ${text.type} + type: text constraints: nullable: false - column: @@ -109,7 +109,7 @@ databaseChangeLog: defaultValueComputed: now() - column: name: last_modified_by - type: ${text.type} + type: text constraints: nullable: false @@ -118,14 +118,14 @@ databaseChangeLog: columns: - column: name: id - type: ${id.type} + type: text constraints: primaryKey: true nullable: false unique: true - column: name: study_id - type: ${id.type} + type: text constraints: references: study(id) foreignKeyName: fk_c_s @@ -134,17 +134,17 @@ databaseChangeLog: remarks: Deleting a study will cascade to delete the cohorts contained in it - column: name: underlay - type: ${text.type} + type: text constraints: nullable: false - column: name: display_name - type: ${text.type} + type: text constraints: nullable: true - column: name: description - type: ${text.type} + type: text constraints: nullable: true - column: @@ -155,7 +155,7 @@ databaseChangeLog: defaultValueComputed: now() - column: name: created_by - type: ${text.type} + type: text constraints: nullable: false - column: @@ -166,7 +166,7 @@ databaseChangeLog: defaultValueComputed: now() - column: name: last_modified_by - type: ${text.type} + type: text constraints: nullable: false @@ -175,14 +175,14 @@ databaseChangeLog: columns: - column: name: id - type: ${id.type} + type: text constraints: primaryKey: true nullable: false unique: true - column: name: cohort_id - type: ${id.type} + type: text constraints: references: cohort(id) foreignKeyName: fk_r_c @@ -191,12 +191,12 @@ databaseChangeLog: remarks: Deleting a cohort will cascade to delete the reviews associated with it - column: name: display_name - type: ${text.type} + type: text constraints: nullable: true - column: name: description - type: ${text.type} + type: text constraints: nullable: true - column: @@ -212,7 +212,7 @@ databaseChangeLog: defaultValueComputed: now() - column: name: created_by - type: ${text.type} + type: text constraints: nullable: false - column: @@ -223,7 +223,7 @@ databaseChangeLog: defaultValueComputed: now() - column: name: last_modified_by - type: ${text.type} + type: text constraints: nullable: false - addUniqueConstraint: @@ -236,7 +236,7 @@ databaseChangeLog: columns: - column: name: review_id - type: ${id.type} + type: text constraints: references: review(id) foreignKeyName: fk_pei_r @@ -245,7 +245,7 @@ databaseChangeLog: remarks: Deleting a review will cascade to delete the entity instances contained in it - column: name: id - type: ${id.type} + type: text constraints: nullable: false unique: false @@ -260,14 +260,14 @@ databaseChangeLog: columns: - column: name: id - type: ${id.type} + type: text constraints: primaryKey: true nullable: false unique: true - column: name: cohort_id - type: ${id.type} + type: text constraints: references: cohort(id) foreignKeyName: fk_cr_c @@ -276,7 +276,7 @@ databaseChangeLog: remarks: Deleting a cohort will cascade to delete the cohort revisions associated with it - column: name: review_id - type: ${id.type} + type: text constraints: references: review(id) foreignKeyName: fk_cr_r @@ -306,7 +306,7 @@ databaseChangeLog: defaultValueComputed: now() - column: name: created_by - type: ${text.type} + type: text constraints: nullable: false - column: @@ -317,7 +317,7 @@ databaseChangeLog: defaultValueComputed: now() - column: name: last_modified_by - type: ${text.type} + type: text constraints: nullable: false @@ -326,12 +326,12 @@ databaseChangeLog: columns: - column: name: id - type: ${id.type} + type: text constraints: nullable: false - column: name: cohort_revision_id - type: ${id.type} + type: text constraints: references: cohort_revision(id) foreignKeyName: fk_cgs_cr @@ -340,10 +340,10 @@ databaseChangeLog: remarks: Deleting a cohort revision will cascade to delete the criteria group sections contained in it - column: name: display_name - type: ${text.type} + type: text - column: name: operator - type: ${text.type} + type: text - column: name: is_excluded type: boolean @@ -364,17 +364,17 @@ databaseChangeLog: columns: - column: name: id - type: ${id.type} + type: text constraints: nullable: false - column: name: criteria_group_section_id - type: ${id.type} + type: text constraints: nullable: false - column: name: cohort_revision_id - type: ${id.type} + type: text constraints: references: cohort_revision(id) foreignKeyName: fk_cg_cr @@ -383,13 +383,13 @@ databaseChangeLog: remarks: Deleting a cohort revision will cascade to delete the criteria groups contained in it - column: name: display_name - type: ${text.type} + type: text - column: name: entity - type: ${text.type} + type: text - column: name: group_by_count_operator - type: ${text.type} + type: text - column: name: group_by_count_value type: integer @@ -408,22 +408,22 @@ databaseChangeLog: columns: - column: name: id - type: ${id.type} + type: text constraints: nullable: false - column: name: criteria_group_id - type: ${id.type} + type: text constraints: nullable: true - column: name: criteria_group_section_id - type: ${id.type} + type: text constraints: nullable: true - column: name: cohort_revision_id - type: ${id.type} + type: text constraints: references: cohort_revision(id) foreignKeyName: ck_crit_cr @@ -432,7 +432,7 @@ databaseChangeLog: remarks: Deleting a cohort revision will cascade to delete the criteria contained in it - column: name: concept_set_id - type: ${id.type} + type: text constraints: references: concept_set(id) foreignKeyName: fk_crit_cs @@ -441,25 +441,25 @@ databaseChangeLog: remarks: Deleting a concept set will cascade to delete the criteria contained in it - column: name: display_name - type: ${text.type} + type: text - column: name: plugin_name - type: ${text.type} + type: text constraints: nullable: false - column: name: selection_data - type: ${long.text.type} + type: text constraints: nullable: false - column: name: ui_config - type: ${long.text.type} + type: text constraints: nullable: false - column: name: tags - type: ${text.array.type} + type: text[] constraints: nullable: false - column: @@ -477,12 +477,12 @@ databaseChangeLog: columns: - column: name: id - type: ${id.type} + type: text constraints: nullable: false - column: name: cohort_id - type: ${id.type} + type: text constraints: references: cohort(id) foreignKeyName: fk_ak_c @@ -491,22 +491,22 @@ databaseChangeLog: remarks: Deleting a cohort will cascade to delete the annotation keys associated with it - column: name: display_name - type: ${text.type} + type: text constraints: nullable: false - column: name: description - type: ${text.type} + type: text constraints: nullable: true - column: name: data_type - type: ${text.type} + type: text constraints: nullable: false - column: name: enum_vals - type: ${text.array.type} + type: text[] constraints: nullable: false - addUniqueConstraint: @@ -519,22 +519,22 @@ databaseChangeLog: columns: - column: name: cohort_id - type: ${id.type} + type: text constraints: nullable: false - column: name: annotation_key_id - type: ${id.type} + type: text constraints: nullable: false - column: name: review_id - type: ${id.type} + type: text constraints: nullable: false - column: name: primary_entity_instance_id - type: ${id.type} + type: text constraints: nullable: false - column: @@ -549,7 +549,7 @@ databaseChangeLog: nullable: true - column: name: string_val - type: ${text.type} + type: text constraints: nullable: true - column: diff --git a/service/src/main/resources/db/changesets/20230530_avoid_postgres_specific_features.yaml b/service/src/main/resources/db/changesets/20230530_avoid_postgres_specific_features.yaml index 81149467d..0d71eb1f9 100644 --- a/service/src/main/resources/db/changesets/20230530_avoid_postgres_specific_features.yaml +++ b/service/src/main/resources/db/changesets/20230530_avoid_postgres_specific_features.yaml @@ -1,7 +1,7 @@ databaseChangeLog: - changeSet: id: avoid_postgres_specific_features - author: marikomedlock, chenchalsubraveti + author: marikomedlock # TODO: Remove the jsonb and 2 text[] columns in a follow-on changeset, once we're sure this migration was successful. # study.properties, criteria.tags, annotation_key.enumVals changes: @@ -10,7 +10,7 @@ databaseChangeLog: columns: - column: name: study_id - type: ${id.type} + type: text constraints: references: study(id) foreignKeyName: fk_sp_s @@ -19,12 +19,12 @@ databaseChangeLog: remarks: Deleting a study will cascade to delete its properties - column: name: key - type: ${id.type} + type: text constraints: nullable: false - column: name: value - type: ${text.type} + type: text constraints: nullable: true - addUniqueConstraint: @@ -43,22 +43,22 @@ databaseChangeLog: columns: - column: name: criteria_id - type: ${id.type} + type: text constraints: nullable: false - column: name: criteria_group_id - type: ${id.type} + type: text constraints: nullable: true - column: name: criteria_group_section_id - type: ${id.type} + type: text constraints: nullable: true - column: name: cohort_revision_id - type: ${id.type} + type: text constraints: references: cohort_revision(id) foreignKeyName: ck_crit_cr @@ -67,7 +67,7 @@ databaseChangeLog: remarks: Deleting a cohort revision will cascade to delete the criteria contained in it - column: name: concept_set_id - type: ${id.type} + type: text constraints: references: concept_set(id) foreignKeyName: fk_crit_cs @@ -76,12 +76,12 @@ databaseChangeLog: remarks: Deleting a concept set will cascade to delete the criteria contained in it - column: name: key - type: ${id.type} + type: text constraints: nullable: false - column: name: value - type: ${text.type} + type: text constraints: nullable: false - addUniqueConstraint: @@ -104,17 +104,17 @@ databaseChangeLog: columns: - column: name: enum - type: ${id.type} + type: text constraints: nullable: false - column: name: annotation_key_id - type: ${id.type} + type: text constraints: nullable: false - column: name: cohort_id - type: ${id.type} + type: text constraints: nullable: false - addUniqueConstraint: From 21f1b9e38ab85c8efb3e2f85b65191fad978cb8c Mon Sep 17 00:00:00 2001 From: Mariko Medlock Date: Tue, 6 Jun 2023 13:39:23 -0400 Subject: [PATCH 2/2] Add dbms tag only to existing changeset files (FOR TESTING). --- .../src/main/resources/db/changesets/20230410_schema_reset.yaml | 1 + .../db/changesets/20230530_avoid_postgres_specific_features.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/service/src/main/resources/db/changesets/20230410_schema_reset.yaml b/service/src/main/resources/db/changesets/20230410_schema_reset.yaml index 31b291be0..3979a19de 100644 --- a/service/src/main/resources/db/changesets/20230410_schema_reset.yaml +++ b/service/src/main/resources/db/changesets/20230410_schema_reset.yaml @@ -2,6 +2,7 @@ databaseChangeLog: - changeSet: id: schema_reset author: marikomedlock + dbms: postgresql changes: - createTable: tableName: study diff --git a/service/src/main/resources/db/changesets/20230530_avoid_postgres_specific_features.yaml b/service/src/main/resources/db/changesets/20230530_avoid_postgres_specific_features.yaml index 0d71eb1f9..17878cc42 100644 --- a/service/src/main/resources/db/changesets/20230530_avoid_postgres_specific_features.yaml +++ b/service/src/main/resources/db/changesets/20230530_avoid_postgres_specific_features.yaml @@ -2,6 +2,7 @@ databaseChangeLog: - changeSet: id: avoid_postgres_specific_features author: marikomedlock + dbms: postgresql # TODO: Remove the jsonb and 2 text[] columns in a follow-on changeset, once we're sure this migration was successful. # study.properties, criteria.tags, annotation_key.enumVals changes: