2022-09-07 20:24:35 +02:00
|
|
|
|
--liquibase formatted sql
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- ============================================================================
|
|
|
|
|
--changeset hs-admin-person-TEST-DATA-GENERATOR:1 endDelimiter:--//
|
|
|
|
|
-- ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Creates a single person test record.
|
|
|
|
|
*/
|
|
|
|
|
create or replace procedure createHsAdminPersonTestData(
|
2022-09-09 17:43:43 +02:00
|
|
|
|
newPersonType HsAdminPersonType,
|
|
|
|
|
newTradeName varchar,
|
|
|
|
|
newFamilyName varchar = null,
|
|
|
|
|
newGivenName varchar = null
|
2022-09-07 20:24:35 +02:00
|
|
|
|
)
|
|
|
|
|
language plpgsql as $$
|
|
|
|
|
declare
|
|
|
|
|
fullName varchar;
|
|
|
|
|
currentTask varchar;
|
|
|
|
|
emailAddr varchar;
|
|
|
|
|
begin
|
2022-09-09 17:43:43 +02:00
|
|
|
|
fullName := concat_ws(', ', newTradeName, newFamilyName, newGivenName);
|
2022-09-07 20:24:35 +02:00
|
|
|
|
currentTask = 'creating RBAC test person ' || fullName;
|
|
|
|
|
emailAddr = 'person-' || left(cleanIdentifier(fullName), 32) || '@example.com';
|
|
|
|
|
call defineContext(currentTask);
|
|
|
|
|
perform createRbacUser(emailAddr);
|
|
|
|
|
call defineContext(currentTask, null, emailAddr);
|
|
|
|
|
execute format('set local hsadminng.currentTask to %L', currentTask);
|
|
|
|
|
|
|
|
|
|
raise notice 'creating test person: %', fullName;
|
|
|
|
|
insert
|
|
|
|
|
into hs_admin_person (persontype, tradename, givenname, familyname)
|
2022-09-09 17:43:43 +02:00
|
|
|
|
values (newPersonType, newTradeName, newGivenName, newFamilyName);
|
2022-09-07 20:24:35 +02:00
|
|
|
|
end; $$;
|
|
|
|
|
--//
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Creates a range of test persons for mass data generation.
|
|
|
|
|
*/
|
|
|
|
|
create or replace procedure createTestPersonTestData(
|
|
|
|
|
startCount integer, -- count of auto generated rows before the run
|
|
|
|
|
endCount integer -- count of auto generated rows after the run
|
|
|
|
|
)
|
|
|
|
|
language plpgsql as $$
|
|
|
|
|
begin
|
|
|
|
|
for t in startCount..endCount
|
|
|
|
|
loop
|
|
|
|
|
call createHsAdminPersonTestData('LEGAL', intToVarChar(t, 4));
|
|
|
|
|
commit;
|
|
|
|
|
end loop;
|
|
|
|
|
end; $$;
|
|
|
|
|
--//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- ============================================================================
|
|
|
|
|
--changeset hs-admin-person-TEST-DATA-GENERATION:1 –context=dev,tc endDelimiter:--//
|
|
|
|
|
-- ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
do language plpgsql $$
|
|
|
|
|
begin
|
2022-09-09 17:43:43 +02:00
|
|
|
|
call createHsAdminPersonTestData('LEGAL', 'First Impressions GmbH');
|
2022-09-07 20:24:35 +02:00
|
|
|
|
call createHsAdminPersonTestData('NATURAL', null, 'Peter', 'Smith');
|
|
|
|
|
call createHsAdminPersonTestData('LEGAL', 'Rockshop e.K.', 'Sandra', 'Miller');
|
2022-09-09 10:40:05 +02:00
|
|
|
|
call createHsAdminPersonTestData('SOLE_REPRESENTATION', 'Ostfriesische Kuhhandel OHG');
|
2022-09-07 20:24:35 +02:00
|
|
|
|
call createHsAdminPersonTestData('JOINT_REPRESENTATION', 'Erbengemeinschaft Bessler', 'Mel', 'Bessler');
|
|
|
|
|
end;
|
|
|
|
|
$$;
|
|
|
|
|
--//
|