From cf7961e8fb2e675e2a6cf2a180701044f5a54301 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 22:52:50 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/integrations/supabase/types.ts | 10 ++++++++++ ...0418225247_e83c1d7f-92ee-48c2-93dc-ceedd507c6a1.sql | 7 +++++++ 2 files changed, 17 insertions(+) create mode 100644 supabase/migrations/20260418225247_e83c1d7f-92ee-48c2-93dc-ceedd507c6a1.sql diff --git a/src/integrations/supabase/types.ts b/src/integrations/supabase/types.ts index dbb610a..6487e8a 100644 --- a/src/integrations/supabase/types.ts +++ b/src/integrations/supabase/types.ts @@ -1326,6 +1326,7 @@ export type Database = { events: { Row: { all_day: boolean + assigned_to: string | null case_id: string | null client_id: string | null created_at: string @@ -1342,6 +1343,7 @@ export type Database = { } Insert: { all_day?: boolean + assigned_to?: string | null case_id?: string | null client_id?: string | null created_at?: string @@ -1358,6 +1360,7 @@ export type Database = { } Update: { all_day?: boolean + assigned_to?: string | null case_id?: string | null client_id?: string | null created_at?: string @@ -1373,6 +1376,13 @@ export type Database = { updated_at?: string } Relationships: [ + { + foreignKeyName: "events_assigned_to_fkey" + columns: ["assigned_to"] + isOneToOne: false + referencedRelation: "profiles" + referencedColumns: ["id"] + }, { foreignKeyName: "events_case_id_fkey" columns: ["case_id"] diff --git a/supabase/migrations/20260418225247_e83c1d7f-92ee-48c2-93dc-ceedd507c6a1.sql b/supabase/migrations/20260418225247_e83c1d7f-92ee-48c2-93dc-ceedd507c6a1.sql new file mode 100644 index 0000000..15e6b69 --- /dev/null +++ b/supabase/migrations/20260418225247_e83c1d7f-92ee-48c2-93dc-ceedd507c6a1.sql @@ -0,0 +1,7 @@ +ALTER TABLE public.events +ADD COLUMN IF NOT EXISTS assigned_to uuid REFERENCES public.profiles(id) ON DELETE SET NULL; + +-- Backfill existing rows: assignee = creator +UPDATE public.events SET assigned_to = created_by WHERE assigned_to IS NULL AND created_by IS NOT NULL; + +CREATE INDEX IF NOT EXISTS events_assigned_to_idx ON public.events(assigned_to); \ No newline at end of file