CrisisCleanup/crisiscleanup-4-web

Fix wwwtsps with null incident_ids

Closed this issue · 1 comments

Issue: Find any wwwtsp with null incident_id. Replace.

UPDATE worksite_worksites_work_types_statuses_phases AS wwwtsp
SET case_number_suffix = 'A'
WHERE wwwtsp.case_number_suffix IS NULL
AND wwwtsp.incident_id IS NULL
AND wwwtsp.work_type_claimed_by IS NOT NULL;
--12

UPDATE worksite_worksites_work_types_statuses_phases AS wwwtsp
SET incident_id = ww.incident_id, phase_id = 4
FROM worksite_worksites AS ww
WHERE wwwtsp.worksite_id = ww.id
AND wwwtsp.incident_id IS NULL;
--214

UPDATE worksite_wwtsp AS wwwtsp
SET incident_id = ww.incident_id, phase_id = 4
FROM worksite_worksites AS ww
WHERE wwwtsp.worksite_id = ww.id
AND wwwtsp.incident_id IS NULL;
--216