If you prefer to run the SQL manually (or if the script fails), execute this SQL in your database:
-- Create roles for RLS policiesDO $$BEGIN IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'authenticated') THEN CREATE ROLE authenticated; END IF; IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'anonymous') THEN CREATE ROLE anonymous; END IF; IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'admin') THEN CREATE ROLE admin; END IF; IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'service') THEN CREATE ROLE service; END IF;END $$;-- Create auth schema and user_id functionCREATE SCHEMA IF NOT EXISTS auth;CREATE OR REPLACE FUNCTION auth.user_id() RETURNS uuid AS $$ SELECT NULLIF(current_setting('auth.user_id', true), '')::uuid;$$ LANGUAGE SQL STABLE;-- Grant usage to rolesGRANT USAGE ON SCHEMA auth TO authenticated, anonymous, admin, service;
If you see permission errors, your database user may not have CREATE ROLE privileges. Contact your database administrator or use a connection with superuser access.