Files
acmcc/supabase/migrations/20260508022635_9bf9fda7-cab0-4b19-92f4-44e887ee7671.sql
T
2026-06-01 20:19:26 -04:00

13 lines
715 B
SQL

-- Add 'management' role to app_role enum
ALTER TYPE public.app_role ADD VALUE IF NOT EXISTS 'management';
-- Add visible_to_roles to amenities (which roles can view this amenity's calendar)
ALTER TABLE public.amenities
ADD COLUMN IF NOT EXISTS visible_to_roles jsonb NOT NULL DEFAULT '[]'::jsonb;
-- Seed default (no permissions) role_permissions rows for the new 'management' role
-- across all existing feature areas; safe to re-run.
INSERT INTO public.role_permissions (role, feature_area, can_read, can_create, can_edit, can_delete)
SELECT 'management', feature_area, false, false, false, false
FROM (SELECT DISTINCT feature_area FROM public.role_permissions) f
ON CONFLICT (role, feature_area) DO NOTHING;