Agenda, Agendador, Configurações
This commit is contained in:
18
DBS/2026-03-11/supabase-snippets/Untitled query 508.sql
Normal file
18
DBS/2026-03-11/supabase-snippets/Untitled query 508.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
create or replace function public.prevent_promoting_to_system()
|
||||
returns trigger
|
||||
language plpgsql
|
||||
as $$
|
||||
begin
|
||||
if new.is_system = true and old.is_system is distinct from true then
|
||||
raise exception 'Não é permitido transformar um grupo comum em grupo do sistema.';
|
||||
end if;
|
||||
return new;
|
||||
end;
|
||||
$$;
|
||||
|
||||
drop trigger if exists trg_prevent_promoting_to_system on public.patient_groups;
|
||||
|
||||
create trigger trg_prevent_promoting_to_system
|
||||
before update on public.patient_groups
|
||||
for each row
|
||||
execute function public.prevent_promoting_to_system();
|
||||
Reference in New Issue
Block a user