From 9b9319689f527c2b9a70028db467da0b9bbc27c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=A4=96?= Date: Fri, 21 Jul 2023 18:20:41 +0000 Subject: [PATCH] chore: babe wake up new migrations just dropped --- 27a69a5_to_aad2e07.sql | 44 ++++++++++++++++++++++++++++++++++++++++++ 885e22c_to_27a69a5.sql | 1 + 2 files changed, 45 insertions(+) create mode 100644 27a69a5_to_aad2e07.sql create mode 100644 885e22c_to_27a69a5.sql diff --git a/27a69a5_to_aad2e07.sql b/27a69a5_to_aad2e07.sql new file mode 100644 index 0000000..74250e2 --- /dev/null +++ b/27a69a5_to_aad2e07.sql @@ -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$ +; diff --git a/885e22c_to_27a69a5.sql b/885e22c_to_27a69a5.sql new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/885e22c_to_27a69a5.sql @@ -0,0 +1 @@ +