commit 74db874cf2132ca092bf86f92f4238c433916b69 parent 105baaf30b1c3e0f0cc2c63d7f4fd2f0b006121b Author: Andreas Gruhler <andreas.gruhler@adfinis.com> Date: Sat, 1 Apr 2023 00:49:07 +0200 feat(heats): enable cascade deletes Diffstat:
M | schema/heats.sql | | | 7 | +++++++ |
M | schema/ratings.sql | | | 2 | +- |
M | schema/startlist.sql | | | 2 | +- |
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/schema/heats.sql b/schema/heats.sql @@ -65,6 +65,13 @@ ALTER TABLE ONLY public.heats -- +-- Name: heats Enable delete for authenticated users only; Type: POLICY; Schema: public; Owner: postgres +-- + +CREATE POLICY "Enable delete for authenticated users only" ON public.heats FOR DELETE TO authenticated USING (true); + + +-- -- Name: heats Enable insert for authenticated users only; Type: POLICY; Schema: public; Owner: postgres -- diff --git a/schema/ratings.sql b/schema/ratings.sql @@ -78,7 +78,7 @@ ALTER TABLE ONLY public.ratings -- ALTER TABLE ONLY public.ratings - ADD CONSTRAINT ratings_heat_fkey FOREIGN KEY (heat) REFERENCES public.heats(id); + ADD CONSTRAINT ratings_heat_fkey FOREIGN KEY (heat) REFERENCES public.heats(id) ON DELETE CASCADE; -- diff --git a/schema/startlist.sql b/schema/startlist.sql @@ -76,7 +76,7 @@ ALTER TABLE ONLY public.startlist -- ALTER TABLE ONLY public.startlist - ADD CONSTRAINT startlist_heat_fkey FOREIGN KEY (heat) REFERENCES public.heats(id); + ADD CONSTRAINT startlist_heat_fkey FOREIGN KEY (heat) REFERENCES public.heats(id) ON DELETE CASCADE; --