11 lines
654 B
SQL
11 lines
654 B
SQL
CREATE TABLE live_query_requests (
|
|
tenant_id uuid NOT NULL, principal text NOT NULL, idempotency_key text NOT NULL,
|
|
request_hash text NOT NULL, plan_id uuid NOT NULL,
|
|
PRIMARY KEY(tenant_id,principal,idempotency_key),
|
|
FOREIGN KEY(tenant_id,plan_id) REFERENCES operation_plans(tenant_id,plan_id)
|
|
);
|
|
ALTER TABLE live_query_requests ENABLE ROW LEVEL SECURITY;
|
|
ALTER TABLE live_query_requests FORCE ROW LEVEL SECURITY;
|
|
CREATE POLICY tenant_scope ON live_query_requests USING (tenant_id::text=current_setting('app.tenant_id',true)) WITH CHECK (tenant_id::text=current_setting('app.tenant_id',true));
|
|
GRANT SELECT, INSERT ON live_query_requests TO rmm_app;
|