structured-liquibase-files #29

Merged
hsh-michaelhoennig merged 11 commits from structured-liquibase-files into master 2024-04-02 12:29:32 +02:00
2 changed files with 6 additions and 6 deletions
Showing only changes of commit 0a033c28f1 - Show all commits

View File

@ -23,7 +23,7 @@ end; $$;
Defines the transaction context. Defines the transaction context.
*/ */
create or replace procedure defineContext( create or replace procedure defineContext(
currentTask varchar(96), currentTask varchar(127),
currentRequest text = null, currentRequest text = null,
currentUser varchar(63) = null, currentUser varchar(63) = null,
assumedRoles varchar(1023) = null assumedRoles varchar(1023) = null
@ -31,8 +31,8 @@ create or replace procedure defineContext(
language plpgsql as $$ language plpgsql as $$
begin begin
currentTask := coalesce(currentTask, ''); currentTask := coalesce(currentTask, '');
assert length(currentTask) <= 96, FORMAT('currentTask must not be longer than 96 characters: "%s"', currentTask); assert length(currentTask) <= 127, FORMAT('currentTask must not be longer than 127 characters: "%s"', currentTask);
assert length(currentTask) > 8, FORMAT('currentTask must be at least 8 characters long: "%s""', currentTask); assert length(currentTask) >= 12, FORMAT('currentTask must be at least 12 characters long: "%s""', currentTask);
execute format('set local hsadminng.currentTask to %L', currentTask); execute format('set local hsadminng.currentTask to %L', currentTask);
currentRequest := coalesce(currentRequest, ''); currentRequest := coalesce(currentRequest, '');
@ -59,11 +59,11 @@ end; $$;
Raises exception if not set. Raises exception if not set.
*/ */
create or replace function currentTask() create or replace function currentTask()
returns varchar(96) returns varchar(127)
stable -- leakproof stable -- leakproof
language plpgsql as $$ language plpgsql as $$
declare declare
currentTask varchar(96); currentTask varchar(127);
begin begin
begin begin
currentTask := current_setting('hsadminng.currentTask'); currentTask := current_setting('hsadminng.currentTask');

View File

@ -28,7 +28,7 @@ create table tx_context
txTimestamp timestamp not null, txTimestamp timestamp not null,
currentUser varchar(63) not null, -- not the uuid, because users can be deleted currentUser varchar(63) not null, -- not the uuid, because users can be deleted
assumedRoles varchar(1023) not null, -- not the uuids, because roles can be deleted assumedRoles varchar(1023) not null, -- not the uuids, because roles can be deleted
currentTask varchar(96) not null, currentTask varchar(127) not null,
currentRequest text not null currentRequest text not null
); );