From be07ab2fa33bec23a8507d117e4ade6250a06736 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 22:52:38 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/integrations/supabase/types.ts | 48 +++++++++++++++++++ ...5_4582e8e4-c42f-48ce-b780-badfd45a3d16.sql | 43 +++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 supabase/migrations/20260417225235_4582e8e4-c42f-48ce-b780-badfd45a3d16.sql diff --git a/src/integrations/supabase/types.ts b/src/integrations/supabase/types.ts index f6151a2..d940019 100644 --- a/src/integrations/supabase/types.ts +++ b/src/integrations/supabase/types.ts @@ -1786,6 +1786,54 @@ export type Database = { } Relationships: [] } + smtp_settings: { + Row: { + created_at: string + enabled: boolean + from_email: string + from_name: string | null + host: string + id: string + notes: string | null + port: number + reply_to: string | null + secure: boolean + updated_at: string + updated_by: string | null + username: string | null + } + Insert: { + created_at?: string + enabled?: boolean + from_email: string + from_name?: string | null + host: string + id?: string + notes?: string | null + port?: number + reply_to?: string | null + secure?: boolean + updated_at?: string + updated_by?: string | null + username?: string | null + } + Update: { + created_at?: string + enabled?: boolean + from_email?: string + from_name?: string | null + host?: string + id?: string + notes?: string | null + port?: number + reply_to?: string | null + secure?: boolean + updated_at?: string + updated_by?: string | null + username?: string | null + } + Relationships: [] + } status_updates: { Row: { body: string diff --git a/supabase/migrations/20260417225235_4582e8e4-c42f-48ce-b780-badfd45a3d16.sql b/supabase/migrations/20260417225235_4582e8e4-c42f-48ce-b780-badfd45a3d16.sql new file mode 100644 index 0000000..167b6e5 --- /dev/null +++ b/supabase/migrations/20260417225235_4582e8e4-c42f-48ce-b780-badfd45a3d16.sql @@ -0,0 +1,43 @@ +create table if not exists public.smtp_settings ( + id uuid primary key default gen_random_uuid(), + host text not null, + port integer not null default 587, + secure boolean not null default false, + username text, + from_email text not null, + from_name text, + reply_to text, + enabled boolean not null default true, + notes text, + created_at timestamptz not null default now(), + updated_at timestamptz not null default now(), + updated_by uuid +); + +alter table public.smtp_settings enable row level security; + +create policy "Admins can read smtp settings" + on public.smtp_settings for select + to authenticated + using (public.is_admin(auth.uid())); + +create policy "Admins can insert smtp settings" + on public.smtp_settings for insert + to authenticated + with check (public.is_admin(auth.uid())); + +create policy "Admins can update smtp settings" + on public.smtp_settings for update + to authenticated + using (public.is_admin(auth.uid())) + with check (public.is_admin(auth.uid())); + +create policy "Admins can delete smtp settings" + on public.smtp_settings for delete + to authenticated + using (public.is_admin(auth.uid())); + +drop trigger if exists trg_smtp_settings_updated_at on public.smtp_settings; +create trigger trg_smtp_settings_updated_at + before update on public.smtp_settings + for each row execute function public.tg_set_updated_at(); \ No newline at end of file