ALTER TABLE gateway_task_admissions
  ADD COLUMN IF NOT EXISTS scope_snapshot jsonb;

ALTER TABLE gateway_task_admissions
  ADD CONSTRAINT gateway_task_admissions_scope_snapshot_array_check
  CHECK (scope_snapshot IS NULL OR jsonb_typeof(scope_snapshot) = 'array') NOT VALID;

ALTER TABLE gateway_task_admissions
  VALIDATE CONSTRAINT gateway_task_admissions_scope_snapshot_array_check;
