-- Zusagen der Eltern (Essen, Deko etc.)
CREATE TABLE public.commitments (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
created_at timestamptz DEFAULT now() NOT NULL,
item_id text NOT NULL, item_name text NOT NULL,
category text NOT NULL, name text NOT NULL,
contact text NOT NULL, note text DEFAULT ''
);
-- Admin-verwaltbare Artikel
CREATE TABLE public.items (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
created_at timestamptz DEFAULT now() NOT NULL,
cat_id text NOT NULL, name text NOT NULL,
qty_label text NOT NULL DEFAULT '1 Stück',
slots int NOT NULL DEFAULT 1,
sort_order int DEFAULT 0, active boolean DEFAULT true
);
-- Helfer-Schichten (mit Zeitangabe)
CREATE TABLE public.shifts (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
created_at timestamptz DEFAULT now() NOT NULL,
name text NOT NULL, description text DEFAULT '',
date_label text NOT NULL DEFAULT 'Einschulungstag',
time_from text NOT NULL, time_to text NOT NULL,
slots int NOT NULL DEFAULT 2,
sort_order int DEFAULT 0, active boolean DEFAULT true
);
-- Anmeldungen für Schichten
CREATE TABLE public.shift_signups (
id uuid DEFAULT gen_random_uuid() PRIMARY KEY,
created_at timestamptz DEFAULT now() NOT NULL,
shift_id uuid REFERENCES public.shifts(id) ON DELETE CASCADE,
name text NOT NULL, contact text DEFAULT '',
klasse text DEFAULT '', note text DEFAULT ''
);
ALTER TABLE public.commitments ENABLE ROW LEVEL SECURITY;
ALTER TABLE public.items ENABLE ROW LEVEL SECURITY;
ALTER TABLE public.shifts ENABLE ROW LEVEL SECURITY;
ALTER TABLE public.shift_signups ENABLE ROW LEVEL SECURITY;
CREATE POLICY "c_read" ON public.commitments FOR SELECT TO anon USING (true);
CREATE POLICY "c_insert" ON public.commitments FOR INSERT TO anon WITH CHECK (true);
CREATE POLICY "c_delete" ON public.commitments FOR DELETE TO anon USING (true);
CREATE POLICY "i_all" ON public.items FOR ALL TO anon USING (true) WITH CHECK (true);
CREATE POLICY "sh_all" ON public.shifts FOR ALL TO anon USING (true) WITH CHECK (true);
CREATE POLICY "ss_read" ON public.shift_signups FOR SELECT TO anon USING (true);
CREATE POLICY "ss_ins" ON public.shift_signups FOR INSERT TO anon WITH CHECK (true);
CREATE POLICY "ss_del" ON public.shift_signups FOR DELETE TO anon USING (true);
3
Seite neu laden
Nach dem Ausführen einfach neu laden – der Planer startet automatisch.