CREATE TABLE IF NOT EXISTS execution_receipts ( id BIGSERIAL PRIMARY KEY, tenant_key TEXT NOT NULL, receipt_id TEXT NOT NULL, skill_name TEXT NOT NULL, input_json JSONB NOT NULL, result_json JSONB NOT NULL, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), UNIQUE (tenant_key, receipt_id) ); CREATE INDEX IF NOT EXISTS execution_receipts_tenant_created_idx ON execution_receipts (tenant_key, created_at DESC); CREATE INDEX IF NOT EXISTS execution_receipts_skill_idx ON execution_receipts (skill_name, created_at DESC);