Some checks failed
Deploy to Cloudflare Workers / deploy (push) Has been cancelled
23 lines
733 B
SQL
23 lines
733 B
SQL
-- Run in Supabase SQL Editor if manager login fails with portal_role 400
|
|
-- Replace USER_ID with your auth user id (from the error URL id=eq....)
|
|
|
|
-- 1) Ensure column exists (or run: npm run db:push)
|
|
-- 2) Set role for your account:
|
|
|
|
UPDATE profiles
|
|
SET portal_role = 'manager'
|
|
WHERE id = 'b8d56b32-d492-4f8b-853c-1a5526ef475e';
|
|
|
|
-- If no profile row exists:
|
|
INSERT INTO profiles (id, display_name, portal_role)
|
|
SELECT
|
|
id,
|
|
COALESCE(raw_user_meta_data->>'display_name', split_part(email, '@', 1)),
|
|
COALESCE(
|
|
(raw_user_meta_data->>'portal_role')::portal_role,
|
|
'manager'::portal_role
|
|
)
|
|
FROM auth.users
|
|
WHERE id = 'b8d56b32-d492-4f8b-853c-1a5526ef475e'
|
|
ON CONFLICT (id) DO UPDATE SET portal_role = EXCLUDED.portal_role;
|