Files
parakasa/migrations/add_sms_templates.sql

15 lines
545 B
SQL

-- SMS TEMPLATES
CREATE TABLE IF NOT EXISTS public.sms_templates (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
title TEXT NOT NULL,
message TEXT NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT timezone('utc'::text, now()) NOT NULL
);
-- RLS Policies for SMS Templates
ALTER TABLE public.sms_templates ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Admins can full access sms templates" ON public.sms_templates USING (
EXISTS (SELECT 1 FROM public.profiles WHERE profiles.id = auth.uid() AND profiles.role = 'admin')
);