diff --git a/migrations/migrations/R__staging-metadata-mapping.sql b/migrations/migrations/R__staging-metadata-mapping.sql index 0b1942608..1cc988192 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,52 @@ 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, + 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, 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..7db91c25e --- /dev/null +++ b/migrations/migrations/V0.33.0__CE-1336.sql @@ -0,0 +1,24 @@ +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'; + +-- 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); + +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