-- Add 'queued' to the contract status enum.
--
-- The unified directive workflow runs contracts sequentially in the
-- directive's shared worktree — only one contract is `active` at a time.
-- When a user clicks "Lock & Start" on a draft, it goes to `active` if
-- the slot is free, otherwise it goes to `queued` and waits for the
-- current active contract to ship/archive. The `complete_contract`
-- handler auto-promotes the lowest-position `queued` row to `active`.
--
-- The constraint replacement is straightforward — drop + re-add. No
-- existing rows can be in 'queued' yet, so the new CHECK is satisfied
-- by every row.

ALTER TABLE directive_documents
    DROP CONSTRAINT IF EXISTS directive_documents_status_check;

ALTER TABLE directive_documents
    ADD CONSTRAINT directive_documents_status_check
    CHECK (status IN ('draft', 'queued', 'active', 'shipped', 'archived'));
