From e8a53ca0dd983e7cbfcdc2870a26d9a0ed54dcb7 Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Mon, 9 Jun 2025 22:53:58 -0400 Subject: [PATCH] add migration --- ...321_add_cascades_to_leaflets_in_publications.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 supabase/migrations/20250610025321_add_cascades_to_leaflets_in_publications.sql diff --git a/supabase/migrations/20250610025321_add_cascades_to_leaflets_in_publications.sql b/supabase/migrations/20250610025321_add_cascades_to_leaflets_in_publications.sql new file mode 100644 index 00000000..720d3698 --- /dev/null +++ b/supabase/migrations/20250610025321_add_cascades_to_leaflets_in_publications.sql @@ -0,0 +1,13 @@ +alter table "public"."publication_subscriptions" alter column "uri" set not null; + +alter table "public"."leaflets_in_publications" drop constraint "leaflets_in_publications_leaflet_fkey"; + +alter table "public"."leaflets_in_publications" drop constraint "leaflets_in_publications_publication_fkey"; + +alter table "public"."leaflets_in_publications" add constraint "leaflets_in_publications_leaflet_fkey" FOREIGN KEY (leaflet) REFERENCES permission_tokens(id) ON DELETE CASCADE not valid; + +alter table "public"."leaflets_in_publications" validate constraint "leaflets_in_publications_leaflet_fkey"; + +alter table "public"."leaflets_in_publications" add constraint "leaflets_in_publications_publication_fkey" FOREIGN KEY (publication) REFERENCES publications(uri) ON DELETE CASCADE not valid; + +alter table "public"."leaflets_in_publications" validate constraint "leaflets_in_publications_publication_fkey"; -- 2.51.2