Files
cloudlense/website-monitoring-frontend/supabase/migrations/20250813102535_fix_user_rls_final.sql
T
Dennis 14a32bdc0d feat: initialize monorepo with full dev team best practices
- Unified monorepo with backend (Express), frontend (Next.js), and devops
- Backend: ESLint, Prettier, Jest tests (3 passing), health endpoint, .env.example
- Frontend: Fixed build errors, fixed all lint errors (0 remaining), tests passing
- DevOps: Docker Compose with PostgreSQL, backend, frontend + healthchecks
- CI/CD: 3 GitHub Actions workflows (backend, frontend, docker integration)
- DX: Husky pre-commit hooks with smart change detection
- Docs: Root README with architecture, CONTRIBUTING.md, PR template

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-06 00:05:50 +01:00

25 lines
1.2 KiB
SQL

-- Final fix for user RLS policies
-- Drop the conflicting policies and create the correct ones
-- Drop existing conflicting policies
DROP POLICY IF EXISTS "Allow user insert for anon" ON "public"."users";
DROP POLICY IF EXISTS "Allow user insert for authenticated" ON "public"."users";
DROP POLICY IF EXISTS "Allow user insert for authenticator" ON "public"."users";
DROP POLICY IF EXISTS "Allow user insert for dashboard_user" ON "public"."users";
-- Create the correct policies
DROP POLICY IF EXISTS "Allow user profile creation during registration" ON "public"."users";
CREATE POLICY "Allow user profile creation during registration" ON "public"."users"
FOR INSERT TO "anon" WITH CHECK (true);
DROP POLICY IF EXISTS "Allow authenticated user profile creation" ON "public"."users";
CREATE POLICY "Allow authenticated user profile creation" ON "public"."users"
FOR INSERT TO "authenticated" WITH CHECK (auth.uid() = id);
DROP POLICY IF EXISTS "Allow user profile creation for service role" ON "public"."users";
CREATE POLICY "Allow user profile creation for service role" ON "public"."users"
FOR INSERT TO "service_role" WITH CHECK (true);
-- Refresh schema cache
NOTIFY pgrst, 'reload schema';