From 128caff2a23d2949c786d911b3a0c814bcde11b6 Mon Sep 17 00:00:00 2001 From: pavel444-byte Date: Sat, 17 Oct 2026 14:17:08 +0500 Subject: [PATCH] Fix live map community schema and refresh API cache --- docs/map-community.md | 2 ++ supabase/migrations/20261017073500_map_community_features.sql | 3 +++ 2 files changed, 5 insertions(+) diff --git a/docs/map-community.md b/docs/map-community.md index 1ec2a58..b8a8761 100644 --- a/docs/map-community.md +++ b/docs/map-community.md @@ -10,6 +10,8 @@ Moderators and admins can remove comments directly on map pages or from **Commen Apply `supabase/migrations/20261017073500_map_community_features.sql` before deploying the application. This adds `map_reactions`, `map_comments`, `community_reports`, and `map_reaction_summary`. All tables enable RLS and restrict access to the server service role. Browser and device-token clients cannot directly read or write these tables. The server routes validate browser sessions, active account status, published-map visibility, and staff roles. +If the server reports `PGRST205` for `public.map_comments`, verify that this migration was applied to the Supabase project configured by the deployed app. Deploying the application source does not apply database migrations. The migration also requests a PostgREST schema-cache reload. If the tables already exist but the cache remains stale, run `NOTIFY pgrst, 'reload schema';` in that project's SQL editor instead of rerunning the table-creation statements. + - `node --import tsx --test tests/community.test.ts` — validation, authentication, moderator authorization, scoped reactions, reporting and review conflicts. - `node scripts/test-community-sql.mjs` — applies the full migration history in isolated PGlite and verifies constraints, counts, duplicates, deletion, and privileges. Uses the same optional `.data/sql-verification` runtime as the existing SQL suites. diff --git a/supabase/migrations/20261017073500_map_community_features.sql b/supabase/migrations/20261017073500_map_community_features.sql index 52ddae9..6898857 100644 --- a/supabase/migrations/20261017073500_map_community_features.sql +++ b/supabase/migrations/20261017073500_map_community_features.sql @@ -64,3 +64,6 @@ language sql stable security invoker set search_path = '' as $$ $$; revoke all on function public.map_reaction_summary(uuid) from public, anon, authenticated; grant execute on function public.map_reaction_summary(uuid) to service_role; + +-- Make new tables and the RPC visible to PostgREST immediately after commit. +notify pgrst, 'reload schema';