From 5c35eb2ef27031fae5ff10a9f5ca4e7c0b5f6d8c Mon Sep 17 00:00:00 2001 From: Ryan Rondeau Date: Wed, 8 Jan 2025 09:18:26 -0800 Subject: [PATCH 1/4] update mapping --- .../R__staging-metadata-mapping.sql | 46 +++++++++++++++++++ migrations/migrations/V0.33.0__CE-1336.sql | 2 + 2 files changed, 48 insertions(+) create mode 100644 migrations/migrations/V0.33.0__CE-1336.sql diff --git a/migrations/migrations/R__staging-metadata-mapping.sql b/migrations/migrations/R__staging-metadata-mapping.sql index 0b1942608..8a0040213 100644 --- a/migrations/migrations/R__staging-metadata-mapping.sql +++ b/migrations/migrations/R__staging-metadata-mapping.sql @@ -23278,6 +23278,29 @@ VALUES CURRENT_TIMESTAMP ) on conflict do nothing; +INSERT INTO + public.staging_metadata_mapping ( + staging_metadata_mapping_guid, + entity_code, + staged_data_value, + live_data_value, + create_user_id, + create_utc_timestamp, + update_user_id, + update_utc_timestamp + ) +VALUES + ( + uuid_generate_v4 (), + 'cmpltntrcd', + 'Livestock/pets - killed/injured - not present (No Black/Grizzly Bear, Wolf, Cougar suspected)', + 'LIVNCOU', + 'FLYWAY', + CURRENT_TIMESTAMP, + 'FLYWAY', + CURRENT_TIMESTAMP + ) on conflict do nothing; + INSERT INTO public.staging_metadata_mapping ( staging_metadata_mapping_guid, @@ -23416,6 +23439,29 @@ VALUES CURRENT_TIMESTAMP ) on conflict do nothing; +INSERT INTO + public.staging_metadata_mapping ( + staging_metadata_mapping_guid, + entity_code, + staged_data_value, + live_data_value, + create_user_id, + create_utc_timestamp, + update_user_id, + update_utc_timestamp + ) +VALUES + ( + uuid_generate_v4 (), + 'cmpltntrcd', + 'Livestock/pets - killed/injured - present/recent/suspected (Black/Grizzly Bear, Wolf, Cougar)', + 'LIVPRES', + 'FLYWAY', + CURRENT_TIMESTAMP, + 'FLYWAY', + CURRENT_TIMESTAMP + ) on conflict do nothing; + INSERT INTO public.staging_metadata_mapping ( staging_metadata_mapping_guid, diff --git a/migrations/migrations/V0.33.0__CE-1336.sql b/migrations/migrations/V0.33.0__CE-1336.sql new file mode 100644 index 000000000..e13ebbfdc --- /dev/null +++ b/migrations/migrations/V0.33.0__CE-1336.sql @@ -0,0 +1,2 @@ +UPDATE hwcr_complaint_nature_code SET long_description = 'Livestock/pets - killed/injured - not present' WHERE hwcr_complaint_nature_code = 'LIVNCOU'; +UPDATE hwcr_complaint_nature_code SET long_description = 'Livestock/pets - killed/injured - present/recent/suspected' WHERE hwcr_complaint_nature_code = 'LIVPRES'; \ No newline at end of file From bae89d05c75334a8d65c4ab0f1a05ee5f54f7a7b Mon Sep 17 00:00:00 2001 From: Ryan Rondeau Date: Thu, 9 Jan 2025 11:14:37 -0800 Subject: [PATCH 2/4] Update V0.33.0__CE-1336.sql --- migrations/migrations/V0.33.0__CE-1336.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/migrations/migrations/V0.33.0__CE-1336.sql b/migrations/migrations/V0.33.0__CE-1336.sql index e13ebbfdc..1e0cec438 100644 --- a/migrations/migrations/V0.33.0__CE-1336.sql +++ b/migrations/migrations/V0.33.0__CE-1336.sql @@ -1,2 +1,5 @@ UPDATE hwcr_complaint_nature_code SET long_description = 'Livestock/pets - killed/injured - not present' WHERE hwcr_complaint_nature_code = 'LIVNCOU'; -UPDATE hwcr_complaint_nature_code SET long_description = 'Livestock/pets - killed/injured - present/recent/suspected' WHERE hwcr_complaint_nature_code = 'LIVPRES'; \ No newline at end of file +UPDATE hwcr_complaint_nature_code SET long_description = 'Livestock/pets - killed/injured - present/recent/suspected' WHERE hwcr_complaint_nature_code = 'LIVPRES'; + +-- Add unique constraing on staging_metadata_mapping for entity_code, staged_data_value, live_data_value +ALTER TABLE public.staging_metadata_mapping ADD CONSTRAINT staging_metadata_mapping_unique UNIQUE (entity_code, staged_data_value, live_data_value); \ No newline at end of file From b4c2f5586934994d30c8b6420e3751473b69ecdb Mon Sep 17 00:00:00 2001 From: Ryan Rondeau Date: Thu, 9 Jan 2025 16:17:40 -0800 Subject: [PATCH 3/4] Update R__staging-metadata-mapping.sql --- .../R__staging-metadata-mapping.sql | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/migrations/migrations/R__staging-metadata-mapping.sql b/migrations/migrations/R__staging-metadata-mapping.sql index 8a0040213..1cc988192 100644 --- a/migrations/migrations/R__staging-metadata-mapping.sql +++ b/migrations/migrations/R__staging-metadata-mapping.sql @@ -23462,6 +23462,29 @@ VALUES CURRENT_TIMESTAMP ) on conflict do nothing; +INSERT INTO + public.staging_metadata_mapping ( + staging_metadata_mapping_guid, + entity_code, + staged_data_value, + live_data_value, + create_user_id, + create_utc_timestamp, + update_user_id, + update_utc_timestamp + ) +VALUES + ( + uuid_generate_v4 (), + 'cmpltntrcd', + 'Livestock/pets - killed/injured - present/recent (Coyote/Bobcat)', + 'LIVPRES', + 'FLYWAY', + CURRENT_TIMESTAMP, + 'FLYWAY', + CURRENT_TIMESTAMP + ) on conflict do nothing; + INSERT INTO public.staging_metadata_mapping ( staging_metadata_mapping_guid, From 5d85ea70bac189fa4e91931977c0f4f1904d6158 Mon Sep 17 00:00:00 2001 From: Ryan Rondeau Date: Fri, 10 Jan 2025 11:24:46 -0800 Subject: [PATCH 4/4] Update V0.33.0__CE-1336.sql --- migrations/migrations/V0.33.0__CE-1336.sql | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/migrations/migrations/V0.33.0__CE-1336.sql b/migrations/migrations/V0.33.0__CE-1336.sql index 1e0cec438..7db91c25e 100644 --- a/migrations/migrations/V0.33.0__CE-1336.sql +++ b/migrations/migrations/V0.33.0__CE-1336.sql @@ -2,4 +2,23 @@ UPDATE hwcr_complaint_nature_code SET long_description = 'Livestock/pets - kille UPDATE hwcr_complaint_nature_code SET long_description = 'Livestock/pets - killed/injured - present/recent/suspected' WHERE hwcr_complaint_nature_code = 'LIVPRES'; -- Add unique constraing on staging_metadata_mapping for entity_code, staged_data_value, live_data_value -ALTER TABLE public.staging_metadata_mapping ADD CONSTRAINT staging_metadata_mapping_unique UNIQUE (entity_code, staged_data_value, live_data_value); \ No newline at end of file +ALTER TABLE public.staging_metadata_mapping ADD CONSTRAINT staging_metadata_mapping_unique UNIQUE (entity_code, staged_data_value, live_data_value); + +UPDATE staging_metadata_mapping SET live_data_value = 'LIVPRES' WHERE entity_code = 'cmpltntrcd' AND staged_data_value = 'Livestock/pets - killed/injured - present/recent (Coyote/Bobcat)'; +UPDATE staging_metadata_mapping SET live_data_value = 'LIVPRES' WHERE entity_code = 'cmpltntrcd' AND staged_data_value = 'Livestock/pets - killed/injured - present/recent/suspected (Black/Grizzly Bear, Wolf, Cougar)'; +UPDATE staging_metadata_mapping SET live_data_value = 'LIVNCOU' WHERE entity_code = 'cmpltntrcd' AND staged_data_value = 'Livestock/pets - killed/injured - not present (No Black/Grizzly Bear, Wolf, Cougar suspected)'; + +UPDATE hwcr_complaint SET hwcr_complaint_nature_code = 'LIVPRES' +WHERE hwcr_complaint_nature_code = (SELECT hwcr_complaint_nature_code FROM hwcr_complaint_nature_code WHERE short_description = LEFT('Livestock/pets - killed/injured - present/recent (Coyote/Bobcat)', 50)); +UPDATE hwcr_complaint_nature_code set active_ind = false +WHERE hwcr_complaint_nature_code = (SELECT hwcr_complaint_nature_code FROM hwcr_complaint_nature_code WHERE short_description = LEFT('Livestock/pets - killed/injured - present/recent (Coyote/Bobcat)', 50)); + +UPDATE hwcr_complaint SET hwcr_complaint_nature_code = 'LIVPRES' +WHERE hwcr_complaint_nature_code = (SELECT hwcr_complaint_nature_code FROM hwcr_complaint_nature_code WHERE short_description = LEFT('Livestock/pets - killed/injured - present/recent/suspected (Black/Grizzly Bear, Wolf, Cougar)', 50)); +UPDATE hwcr_complaint_nature_code set active_ind = false +WHERE hwcr_complaint_nature_code = (SELECT hwcr_complaint_nature_code FROM hwcr_complaint_nature_code WHERE short_description = LEFT('Livestock/pets - killed/injured - present/recent/suspected (Black/Grizzly Bear, Wolf, Cougar)', 50)); + +UPDATE hwcr_complaint SET hwcr_complaint_nature_code = 'LIVNCOU' +WHERE hwcr_complaint_nature_code = (SELECT hwcr_complaint_nature_code FROM hwcr_complaint_nature_code WHERE short_description = LEFT('Livestock/pets - killed/injured - not present (No Black/Grizzly Bear, Wolf, Cougar suspected)', 50)); +UPDATE hwcr_complaint_nature_code set active_ind = false +WHERE hwcr_complaint_nature_code = (SELECT hwcr_complaint_nature_code FROM hwcr_complaint_nature_code WHERE short_description = LEFT('Livestock/pets - killed/injured - not present (No Black/Grizzly Bear, Wolf, Cougar suspected)', 50)); \ No newline at end of file