salix/db/versions/10926-limeFern/00-refactorClaimState.sql

9 lines
291 B
SQL

UPDATE vn.claim c
JOIN vn.claimState cs ON cs.id = c.claimStateFk
JOIN vn.claimState ns ON ns.code = 'resolved'
SET c.claimStateFk = ns.id
WHERE cs.code IN ('managed', 'mana', 'lack', 'relocation');
DELETE FROM vn.claimState
WHERE code IN ('managed', 'mana', 'lack', 'relocation');