Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / db/migrations/0084_scope_split_status.sql |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | db/migrations/0084_scope_split_status.sql |
| Original SHA-256 | 36cfe0d654fcd7020e1de6550eeea5487b692e4b87ef6fce8a7c16226b4a1e23 |
| Git blob SHA | e9f4d16276fad48f3e768a17f561a895fb1d860a |
| Reading-copy SHA-256 | 36cfe0d654fcd7020e1de6550eeea5487b692e4b87ef6fce8a7c16226b4a1e23 |
Recovered source transcript
Download complete source text ↓34 lines · 2.4 KB
-- +goose Up
-- PHASE 2 ITEM 4 completion. Screen 4 requires accept, edit and accept, reject, SPLIT, MERGE, and add
-- manually. Split and merge had no operations at all: 'merged' existed as a status value that nothing ever
-- wrote, and split had no representation of any kind.
--
-- WHY A NEW STATUS IS NEEDED RATHER THAN REUSING ONE. A split parent is superseded by its children, which is
-- a different fact from every value already available. Marking it 'rejected' would say a reviewer refused the
-- item, which is false and would corrupt any count of what review actually rejected. Marking it 'merged'
-- would conflate the two operations this migration exists to distinguish. So 'split' is added, and nothing
-- is renamed or removed.
--
-- THE CHECK IS WIDENED FROM THE CURRENT VOCABULARY, NOT FROM 0076'S. This build already learned that lesson
-- the expensive way: rebuilding a CHECK from an older migration's list silently drops every value a later
-- migration added. All six existing values are restated here deliberately, and any future widening must read
-- the constraint as it stands rather than as it was first written.
ALTER TABLE opportunity_scope_items DROP CONSTRAINT IF EXISTS opportunity_scope_items_review_status_check;
ALTER TABLE opportunity_scope_items
ADD CONSTRAINT opportunity_scope_items_review_status_check
CHECK (review_status IN ('extracted','accepted','edited','rejected','merged','manual','split'));
-- The citation rule is UNCHANGED and still load bearing: split children inherit the parent's source document,
-- page, section label and quote hash, so every child remains cited by the same span the parent was cited by.
-- A split cannot launder a machine produced item into an uncited one, and ck_scope_items_cited still refuses
-- it if anything tries.
-- +goose Down
-- Any row already carrying 'split' has to go somewhere the old constraint permits before it is restored.
-- 'merged' is the closest surviving meaning: superseded by another item, not rejected by a human.
UPDATE opportunity_scope_items SET review_status = 'merged' WHERE review_status = 'split';
ALTER TABLE opportunity_scope_items DROP CONSTRAINT IF EXISTS opportunity_scope_items_review_status_check;
ALTER TABLE opportunity_scope_items
ADD CONSTRAINT opportunity_scope_items_review_status_check
CHECK (review_status IN ('extracted','accepted','edited','rejected','merged','manual'));