chore: babe wake up new migrations just dropped

This commit is contained in:
🤖 2023-07-21 18:20:41 +00:00
parent df0d11817c
commit 9b9319689f
2 changed files with 45 additions and 0 deletions

44
27a69a5_to_aad2e07.sql Normal file
View File

@ -0,0 +1,44 @@
set check_function_bodies = off;
CREATE OR REPLACE FUNCTION public.unset_acting_usr()
RETURNS void
LANGUAGE plpgsql
AS $function$
begin
perform set_config('dnim.usr_uid', '', false);
end;
$function$
;
CREATE OR REPLACE FUNCTION public.get_acting_usr()
RETURNS usr
LANGUAGE plpgsql
AS $function$
declare
acting_usr public.usr;
begin
if nullif(current_setting('dnim.usr_uid', true), '') is null then
acting_usr := public.usr_root();
else
select u.*
from public.usr u
where u.uid = human_uuid.huid_of_string(current_setting('dnim.usr_uid', true))
into acting_usr;
end if;
return coalesce(acting_usr, public.usr_root());
end;
$function$
;
CREATE OR REPLACE FUNCTION public.set_acting_usr(uid text)
RETURNS void
LANGUAGE plpgsql
AS $function$
begin
if uid is not null and uid != '' then
perform set_config('dnim.usr_uid', uid, false);
end if;
end;
$function$
;

1
885e22c_to_27a69a5.sql Normal file
View File

@ -0,0 +1 @@