wip: currently rewriting the project as a full stack application tangled.org/kacaii.dev/sigo
gleam
at main 22 lines 658 B view raw
1--  Sets default user notification preferences when inserting a new one 2create or replace function public.set_default_notification_preferences() 3returns trigger 4language plpgsql 5as $$ 6begin 7 insert into public.user_notification_preference (user_id, notification_type) 8 values 9 (new.id, 'fire'), 10 (new.id, 'emergency'), 11 (new.id, 'traffic'), 12 (new.id, 'other') 13 on conflict (user_id, notification_type) do nothing; 14 15 return new; 16end; 17$$; 18 19create or replace trigger tgr_default_notification_preferences 20after insert on public.user_account 21for each row 22execute function public.set_default_notification_preferences();