Added category deletion interface

This commit is contained in:
Alexis
2025-04-15 20:32:03 +02:00
parent 58f3783b13
commit 1e0d840b41
9 changed files with 245 additions and 17 deletions

View File

@@ -106,7 +106,7 @@ create table public.calendar_events (
location text,
start_date json not null,
end_date json,
category bigint references public.calendar_event_categories on delete cascade,
category bigint references public.calendar_event_categories on delete set null,
hidden boolean default false,
wiki text,
created_at timestamptz default now(),
@@ -150,7 +150,7 @@ create table public.characters (
description text,
birth json not null,
death json,
category bigint references public.character_categories on delete cascade,
category bigint references public.character_categories on delete set null,
hidden_birth boolean,
hidden_death boolean,
wiki text,
@@ -468,6 +468,20 @@ create policy "Allow GMs to update their events categories"
)
);
create policy "Allow GMs to delete their events categories"
on public.calendar_event_categories
for delete
using (
exists (
select 1
from public.calendars c
join public.worlds w on w.id = c.world_id
where
c.id = calendar_event_categories.calendar_id
and w.gm_id = auth.uid()
)
);
-- Send "previous data" on change
alter table public.users replica identity full;