Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: CE-1336 #856

Open
wants to merge 8 commits into
base: release/0.6.12
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions migrations/migrations/R__staging-metadata-mapping.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
24 changes: 24 additions & 0 deletions migrations/migrations/V0.33.0__CE-1336.sql
Original file line number Diff line number Diff line change
@@ -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));
Loading