From 3d64deb49d9a5764da2c82f08e40e30751c7f3c7 Mon Sep 17 00:00:00 2001 From: Sergei Veselev Date: Thu, 10 Oct 2024 11:48:57 -0400 Subject: [PATCH] CNDE-1805 Fix missing cd_desc_txt --- .../db.rdb_modern.changelog-16.1.yaml | 9 +++++- .../tables/017-create_nrt_observation-002.sql | 25 ---------------- .../tables/017-create_nrt_observation-003.sql | 29 ------------------- .../tables/017-create_nrt_observation-004.sql | 10 +++++++ .../repository/model/dto/Observation.java | 2 +- .../model/reporting/ObservationReporting.java | 1 + 6 files changed, 20 insertions(+), 56 deletions(-) create mode 100644 liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation-004.sql diff --git a/liquibase-service/src/main/resources/db/changelog/db.rdb_modern.changelog-16.1.yaml b/liquibase-service/src/main/resources/db/changelog/db.rdb_modern.changelog-16.1.yaml index a661973..471ad13 100644 --- a/liquibase-service/src/main/resources/db/changelog/db.rdb_modern.changelog-16.1.yaml +++ b/liquibase-service/src/main/resources/db/changelog/db.rdb_modern.changelog-16.1.yaml @@ -355,4 +355,11 @@ databaseChangeLog: changes: - sqlFile: path: 017-sp_d_labtest_result_postprocessing-001.sql - splitStatements: false \ No newline at end of file + splitStatements: false + - changeSet: + id: 51 + author: liquibase + changes: + - sqlFile: + path: 017-create_nrt_observation-004.sql + splitStatements: false diff --git a/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation-002.sql b/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation-002.sql index 363c237..f7cae53 100644 --- a/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation-002.sql +++ b/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation-002.sql @@ -7,29 +7,4 @@ IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_observation' and xtype = ' ADD ctrl_cd_display_form varchar(20); END; - IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE Name = N'obs_domain_cd_st_1' AND Object_ID = Object_ID(N'nrt_observation')) - BEGIN - ALTER TABLE nrt_observation - ADD obs_domain_cd_st_1 varchar(20); - - END; - IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE Name = N'processing_decision_cd' AND Object_ID = Object_ID(N'nrt_observation')) - BEGIN - ALTER TABLE nrt_observation - ADD processing_decision_cd varchar(20); - - END; - - IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE Name = N'cd' AND Object_ID = Object_ID(N'nrt_observation')) - BEGIN - ALTER TABLE nrt_observation - ADD cd varchar(50); - END; - - IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE Name = N'shared_ind' AND Object_ID = Object_ID(N'nrt_observation')) - BEGIN - ALTER TABLE nrt_observation - ADD shared_ind char(1); - END; - END; \ No newline at end of file diff --git a/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation-003.sql b/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation-003.sql index ef906e6..9ed7289 100644 --- a/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation-003.sql +++ b/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation-003.sql @@ -1,34 +1,5 @@ IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_observation' and xtype = 'U') BEGIN - IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'ctrl_cd_display_form' AND object_id = Object_ID(N'nrt_observation')) - BEGIN - ALTER TABLE nrt_observation - ADD ctrl_cd_display_form varchar(20); - END; - - IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'obs_domain_cd_st_1' AND object_id = Object_ID(N'nrt_observation')) - BEGIN - ALTER TABLE nrt_observation - ADD obs_domain_cd_st_1 varchar(20); - END; - - IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'processing_decision_cd' AND object_id = Object_ID(N'nrt_observation')) - BEGIN - ALTER TABLE nrt_observation - ADD processing_decision_cd varchar(20); - END; - - IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'cd' AND object_id = Object_ID(N'nrt_observation')) - BEGIN - ALTER TABLE nrt_observation - ADD cd varchar(50); - END; - - IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'shared_ind' AND object_id = Object_ID(N'nrt_observation')) - BEGIN - ALTER TABLE nrt_observation - ADD shared_ind char(1); - END; IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'status_cd' AND object_id = Object_ID(N'nrt_observation')) BEGIN diff --git a/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation-004.sql b/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation-004.sql new file mode 100644 index 0000000..4294cda --- /dev/null +++ b/liquibase-service/src/main/resources/db/rdb_modern/tables/017-create_nrt_observation-004.sql @@ -0,0 +1,10 @@ +IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_observation' and xtype = 'U') + BEGIN + + IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE Name = N'cd_desc_txt' AND Object_ID = Object_ID(N'nrt_observation')) + BEGIN + ALTER TABLE nrt_observation + ADD cd_desc_txt varchar(1000); + END; + + END; \ No newline at end of file diff --git a/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/dto/Observation.java b/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/dto/Observation.java index 4df5621..6a8e5b4 100644 --- a/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/dto/Observation.java +++ b/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/dto/Observation.java @@ -34,7 +34,7 @@ public class Observation { private String obsDomainCdSt1; @Column(name = "cd_desc_txt") - private String cdDescText; + private String cdDescTxt; @Column(name = "record_status_cd") private String recordStatusCd; diff --git a/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/reporting/ObservationReporting.java b/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/reporting/ObservationReporting.java index 55d6f3d..e4c1cac 100644 --- a/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/reporting/ObservationReporting.java +++ b/observation-service/src/main/java/gov/cdc/etldatapipeline/observation/repository/model/reporting/ObservationReporting.java @@ -31,6 +31,7 @@ public class ObservationReporting { private String ctrlCdDisplayForm; private String processingDecisionCd; private String cd; + private String cdDescTxt; private String sharedInd; private String statusCd;