-- 8. SEARCH CACHE (Optimization) create table if not exists public.search_cache ( id uuid default uuid_generate_v4() primary key, query text not null, type text default 'specific', -- 'specific' or 'opportunity' results jsonb, created_at timestamp with time zone default timezone('utc'::text, now()) not null ); -- Index for faster lookups create index if not exists idx_search_cache_query on public.search_cache(query); -- Specific policy to allow read/write (if RLS is on, though usually service_role bypasses, but good to have) alter table public.search_cache enable row level security; create policy "Enable read access for authenticated users" on "public"."search_cache" as PERMISSIVE for SELECT to authenticated using (true); create policy "Enable insert access for authenticated users" on "public"."search_cache" as PERMISSIVE for INSERT to authenticated with check (true);