CREATE TABLE thoth_memory.reviews ( workspace_id text NOT NULL, session_id text NOT NULL, summary_id text NOT NULL, request_hash text NOT NULL, result jsonb NOT NULL, created_at timestamptz NOT NULL DEFAULT now(), PRIMARY KEY (workspace_id, session_id, summary_id) ); ALTER TABLE thoth_memory.reviews ENABLE ROW LEVEL SECURITY; ALTER TABLE thoth_memory.reviews FORCE ROW LEVEL SECURITY; CREATE POLICY workspace_isolation ON thoth_memory.reviews USING (workspace_id = current_setting('thoth.memory_workspace', true)) WITH CHECK (workspace_id = current_setting('thoth.memory_workspace', true)); GRANT SELECT, INSERT ON thoth_memory.reviews TO thoth_memory_runtime; CREATE TABLE thoth_memory.cleanup_receipts ( workspace_id text NOT NULL, sync_id text NOT NULL, request_hash text NOT NULL, card_ids jsonb NOT NULL, PRIMARY KEY (workspace_id, sync_id) ); ALTER TABLE thoth_memory.cleanup_receipts ENABLE ROW LEVEL SECURITY; ALTER TABLE thoth_memory.cleanup_receipts FORCE ROW LEVEL SECURITY; CREATE POLICY workspace_isolation ON thoth_memory.cleanup_receipts USING (workspace_id = current_setting('thoth.memory_workspace', true)) WITH CHECK (workspace_id = current_setting('thoth.memory_workspace', true)); GRANT SELECT, INSERT ON thoth_memory.cleanup_receipts TO thoth_memory_runtime;