-- Reference schema for the SOURCE SYSTEM'S database, not WCS production. -- Apply using the source system's migration role and grant only needed rights. CREATE TABLE wcs_callback_inbox ( connector_id uuid NOT NULL, event_id bigint NOT NULL CHECK (event_id > 0), project_id uuid NOT NULL, version_id uuid NOT NULL, artifact_fingerprint text NOT NULL CHECK (artifact_fingerprint ~ '^[a-f0-9]{64}$'), payload_sha256 text NOT NULL CHECK (payload_sha256 ~ '^[a-f0-9]{64}$'), payload jsonb NOT NULL, received_at timestamptz NOT NULL DEFAULT now(), state text NOT NULL DEFAULT 'pending' CHECK (state IN ('pending','processing','downloaded','manual_review')), PRIMARY KEY (connector_id,event_id) );