mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 09:50:01 +00:00
183fe0a93c
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
32 lines
1.3 KiB
SQL
32 lines
1.3 KiB
SQL
|
|
CREATE TABLE public.pdf_form_templates (
|
|
id UUID NOT NULL DEFAULT gen_random_uuid() PRIMARY KEY,
|
|
association_id UUID NOT NULL REFERENCES public.associations(id) ON DELETE CASCADE,
|
|
name TEXT NOT NULL,
|
|
description TEXT,
|
|
fields JSONB NOT NULL DEFAULT '[]'::jsonb,
|
|
page_settings JSONB NOT NULL DEFAULT '{"margins":{"top":48,"bottom":48,"left":48,"right":48},"orientation":"portrait"}'::jsonb,
|
|
created_by UUID,
|
|
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
|
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now()
|
|
);
|
|
|
|
ALTER TABLE public.pdf_form_templates ENABLE ROW LEVEL SECURITY;
|
|
|
|
CREATE POLICY "Authenticated users can view pdf form templates"
|
|
ON public.pdf_form_templates FOR SELECT TO authenticated USING (true);
|
|
|
|
CREATE POLICY "Authenticated users can create pdf form templates"
|
|
ON public.pdf_form_templates FOR INSERT TO authenticated WITH CHECK (true);
|
|
|
|
CREATE POLICY "Authenticated users can update pdf form templates"
|
|
ON public.pdf_form_templates FOR UPDATE TO authenticated USING (true);
|
|
|
|
CREATE POLICY "Authenticated users can delete pdf form templates"
|
|
ON public.pdf_form_templates FOR DELETE TO authenticated USING (true);
|
|
|
|
CREATE TRIGGER update_pdf_form_templates_updated_at
|
|
BEFORE UPDATE ON public.pdf_form_templates
|
|
FOR EACH ROW
|
|
EXECUTE FUNCTION public.update_updated_at_column();
|