hs-customer SQL-Scripts in Liquibase
This commit is contained in:
parent
8ba952a41d
commit
61c50c46ed
@ -104,6 +104,7 @@ create trigger createRbacRolesForCustomer_Trigger
|
|||||||
execute procedure createRbacRolesForCustomer();
|
execute procedure createRbacRolesForCustomer();
|
||||||
--//
|
--//
|
||||||
|
|
||||||
|
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
--changeset hs-customer-rbac-ROLES-REMOVAL:1 endDelimiter:--//
|
--changeset hs-customer-rbac-ROLES-REMOVAL:1 endDelimiter:--//
|
||||||
-- ----------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------
|
||||||
@ -116,8 +117,6 @@ create or replace function deleteRbacRulesForCustomer()
|
|||||||
returns trigger
|
returns trigger
|
||||||
language plpgsql
|
language plpgsql
|
||||||
strict as $$
|
strict as $$
|
||||||
declare
|
|
||||||
objectTable varchar = 'customer';
|
|
||||||
begin
|
begin
|
||||||
if TG_OP = 'DELETE' then
|
if TG_OP = 'DELETE' then
|
||||||
call deleteRole(findRoleId(customerOwner(OLD)));
|
call deleteRole(findRoleId(customerOwner(OLD)));
|
||||||
|
@ -1,7 +1,23 @@
|
|||||||
|
--liquibase formatted sql
|
||||||
|
|
||||||
|
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
--changeset hs-customer-TEST-DATA-GENERATOR:1 endDelimiter:--//
|
--changeset hs-customer-TEST-DATA-GENERATOR:1 endDelimiter:--//
|
||||||
-- ----------------------------------------------------------------------------
|
-- ----------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
Generates a customer reference number for a given test data counter.
|
||||||
|
*/
|
||||||
|
create or replace function testCustomerReference(customerCount integer)
|
||||||
|
returns integer
|
||||||
|
returns null on null input
|
||||||
|
language plpgsql as $$
|
||||||
|
begin
|
||||||
|
return 10000 + customerCount;
|
||||||
|
end; $$;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Creates test data for the customer main table.
|
||||||
|
*/
|
||||||
create or replace procedure createCustomerTestData(
|
create or replace procedure createCustomerTestData(
|
||||||
startCount integer, -- count of auto generated rows before the run
|
startCount integer, -- count of auto generated rows before the run
|
||||||
endCount integer, -- count of auto generated rows after the run
|
endCount integer, -- count of auto generated rows after the run
|
||||||
@ -25,7 +41,7 @@ begin
|
|||||||
set local hsadminng.currentTask to currentTask;
|
set local hsadminng.currentTask to currentTask;
|
||||||
|
|
||||||
-- When a new customer is created,
|
-- When a new customer is created,
|
||||||
custReference = 10000 + t;
|
custReference = testCustomerReference(t);
|
||||||
custRowId = uuid_generate_v4();
|
custRowId = uuid_generate_v4();
|
||||||
custPrefix = intToVarChar(t, 3);
|
custPrefix = intToVarChar(t, 3);
|
||||||
custAdminName = 'admin@' || custPrefix || '.example.com';
|
custAdminName = 'admin@' || custPrefix || '.example.com';
|
||||||
|
Loading…
Reference in New Issue
Block a user