pub const POSTGRES_SCHEMA_SQL: &str = "CREATE TABLE IF NOT EXISTS mcp_write_receipts (
scope TEXT NOT NULL,
operation TEXT NOT NULL,
idempotency_key TEXT NOT NULL,
status TEXT NOT NULL CHECK (status IN ('in_progress', 'succeeded')),
claim_token TEXT,
input_hash TEXT NOT NULL,
receipt_json JSONB,
created_at_ms BIGINT NOT NULL,
completed_at_ms BIGINT,
lease_expires_at_ms BIGINT,
expires_at_ms BIGINT,
retain_until_ms BIGINT,
PRIMARY KEY (scope, operation, idempotency_key)
);
CREATE INDEX IF NOT EXISTS expiry_mcp_write_receipts ON mcp_write_receipts(expires_at_ms);";