introduce-separate-database-schema-hs-office-and-amend-generators #105
@ -213,7 +213,7 @@ public class InsertTriggerGenerator {
|
||||
if (g.getSuperRoleDef().isGlobal(GUEST)) {
|
||||
plPgSql.writeLn(
|
||||
"""
|
||||
-- check INSERT INSERT permission for rbac.global anyone
|
||||
-- check INSERT permission for rbac.global anyone
|
||||
if ${caseCondition}true then
|
||||
return NEW;
|
||||
end if;
|
||||
@ -222,7 +222,7 @@ public class InsertTriggerGenerator {
|
||||
} else if (g.getSuperRoleDef().isGlobal(ADMIN)) {
|
||||
plPgSql.writeLn(
|
||||
"""
|
||||
-- check INSERT INSERT if rbac.global ADMIN
|
||||
-- check INSERT permission if rbac.global ADMIN
|
||||
if ${caseCondition}rbac.isGlobalAdmin() then
|
||||
return NEW;
|
||||
end if;
|
||||
|
@ -384,7 +384,7 @@ create index on rbac.permission (objectUuid, op);
|
||||
create index on rbac.permission (opTableName, op);
|
||||
|
||||
ALTER TABLE rbac.permission
|
||||
ADD CONSTRAINT RbacPermission_uc UNIQUE NULLS NOT DISTINCT (objectUuid, op, opTableName);
|
||||
ADD CONSTRAINT unique_including_null_values UNIQUE NULLS NOT DISTINCT (objectUuid, op, opTableName);
|
||||
|
||||
call base.create_journal('rbac.permission');
|
||||
|
||||
|
@ -137,7 +137,7 @@ create or replace function rbactest.customer_insert_permission_check_tf()
|
||||
declare
|
||||
superObjectUuid uuid;
|
||||
begin
|
||||
-- check INSERT INSERT if rbac.global ADMIN
|
||||
-- check INSERT permission if rbac.global ADMIN
|
||||
if rbac.isGlobalAdmin() then
|
||||
return NEW;
|
||||
end if;
|
||||
|
@ -48,7 +48,7 @@ create table hs_office.partner
|
||||
/**
|
||||
Trigger function to delete related details of a partner to delete.
|
||||
*/
|
||||
create or replace function deleteHsOfficeDependentsOnPartnerDelete()
|
||||
create or replace function hs_office.partner_delete_dependents_tf()
|
||||
returns trigger
|
||||
language PLPGSQL
|
||||
as $$
|
||||
@ -73,11 +73,11 @@ end; $$;
|
||||
/**
|
||||
Triggers deletion of related rows of a partner to delete.
|
||||
*/
|
||||
create trigger hs_office.partner_delete_dependents_trigger
|
||||
create trigger delete_dependents_tg
|
||||
after delete
|
||||
on hs_office.partner
|
||||
for each row
|
||||
execute procedure deleteHsOfficeDependentsOnPartnerDelete();
|
||||
execute procedure hs_office.partner_delete_dependents_tf();
|
||||
|
||||
-- ============================================================================
|
||||
--changeset michael.hoennig:hs-office-partner-MAIN-TABLE-JOURNAL endDelimiter:--//
|
||||
|
@ -214,7 +214,7 @@ create or replace function hs_office.partner_insert_permission_check_tf()
|
||||
declare
|
||||
superObjectUuid uuid;
|
||||
begin
|
||||
-- check INSERT INSERT if rbac.global ADMIN
|
||||
-- check INSERT permission if rbac.global ADMIN
|
||||
if rbac.isGlobalAdmin() then
|
||||
return NEW;
|
||||
end if;
|
||||
|
@ -118,7 +118,7 @@ create or replace function hs_office.partner_details_insert_permission_check_tf(
|
||||
declare
|
||||
superObjectUuid uuid;
|
||||
begin
|
||||
-- check INSERT INSERT if rbac.global ADMIN
|
||||
-- check INSERT permission if rbac.global ADMIN
|
||||
if rbac.isGlobalAdmin() then
|
||||
return NEW;
|
||||
end if;
|
||||
|
@ -29,9 +29,9 @@ create table hs_office.debitor
|
||||
-- ----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
Trigger function to delete related rows of a debitor to delete.
|
||||
Trigger function to delete related relations of a debitor to delete.
|
||||
*/
|
||||
create or replace function deleteHsOfficeDependentsOnDebitorDelete()
|
||||
create or replace function hs_office.debitor_delete_dependents_tf()
|
||||
returns trigger
|
||||
language PLPGSQL
|
||||
as $$
|
||||
@ -50,11 +50,11 @@ end; $$;
|
||||
/**
|
||||
Triggers deletion of related details of a debitor to delete.
|
||||
*/
|
||||
create trigger hs_office.debitor_delete_dependents_trigger
|
||||
create trigger debitor_delete_dependents_tg
|
||||
after delete
|
||||
on hs_office.debitor
|
||||
for each row
|
||||
execute procedure deleteHsOfficeDependentsOnDebitorDelete();
|
||||
execute procedure hs_office.debitor_delete_dependents_tf();
|
||||
|
||||
|
||||
-- ============================================================================
|
||||
|
@ -187,7 +187,7 @@ create or replace function hs_office.debitor_insert_permission_check_tf()
|
||||
declare
|
||||
superObjectUuid uuid;
|
||||
begin
|
||||
-- check INSERT INSERT if rbac.global ADMIN
|
||||
-- check INSERT permission if rbac.global ADMIN
|
||||
if rbac.isGlobalAdmin() then
|
||||
return NEW;
|
||||
end if;
|
||||
|
@ -149,7 +149,7 @@ create or replace function hs_office.membership_insert_permission_check_tf()
|
||||
declare
|
||||
superObjectUuid uuid;
|
||||
begin
|
||||
-- check INSERT INSERT if rbac.global ADMIN
|
||||
-- check INSERT permission if rbac.global ADMIN
|
||||
if rbac.isGlobalAdmin() then
|
||||
return NEW;
|
||||
end if;
|
||||
|
@ -27,7 +27,7 @@ create table if not exists hs_office.coopsharestransaction
|
||||
-- ----------------------------------------------------------------------------
|
||||
|
||||
alter table hs_office.coopsharestransaction
|
||||
add constraint hs_office.coopsharestransaction_reverse_entry_missing
|
||||
add constraint reverse_entry_missing
|
||||
check ( transactionType = 'ADJUSTMENT' and adjustedShareTxUuid is not null
|
||||
or transactionType <> 'ADJUSTMENT' and adjustedShareTxUuid is null);
|
||||
--//
|
||||
@ -55,7 +55,7 @@ begin
|
||||
end; $$;
|
||||
|
||||
alter table hs_office.coopsharestransaction
|
||||
add constraint hs_office.coopshares_positive
|
||||
add constraint check_positive_total_shares_count
|
||||
check ( checkSharesByMembershipUuid(membershipUuid, shareCount) );
|
||||
|
||||
--//
|
||||
|
@ -35,7 +35,7 @@ create table if not exists hs_office.coopassetstransaction
|
||||
-- ----------------------------------------------------------------------------
|
||||
|
||||
alter table hs_office.coopassetstransaction
|
||||
add constraint hs_office.coopassetstransaction_reverse_entry_missing
|
||||
add constraint reverse_entry_missing
|
||||
check ( transactionType = 'ADJUSTMENT' and adjustedAssetTxUuid is not null
|
||||
or transactionType <> 'ADJUSTMENT' and adjustedAssetTxUuid is null);
|
||||
--//
|
||||
@ -63,7 +63,7 @@ begin
|
||||
end; $$;
|
||||
|
||||
alter table hs_office.coopassetstransaction
|
||||
add constraint hs_office.coopassets_positive
|
||||
add constraint check_positive_total
|
||||
check ( checkAssetsByMembershipUuid(membershipUuid, assetValue) );
|
||||
--//
|
||||
|
||||
|
@ -225,7 +225,7 @@ create or replace function hs_booking_item_insert_permission_check_tf()
|
||||
declare
|
||||
superObjectUuid uuid;
|
||||
begin
|
||||
-- check INSERT INSERT if rbac.global ADMIN
|
||||
-- check INSERT permission if rbac.global ADMIN
|
||||
if rbac.isGlobalAdmin() then
|
||||
return NEW;
|
||||
end if;
|
||||
|
@ -141,7 +141,7 @@ class HsOfficeDebitorRepositoryIntegrationTest extends ContextBasedTestWithClean
|
||||
|
||||
// then
|
||||
result.assertExceptionWithRootCauseMessage(org.hibernate.exception.ConstraintViolationException.class,
|
||||
"ERROR: new row for relation \"hs_office.debitor\" violates check constraint \"check_default_prefix\"");
|
||||
"ERROR: new row for relation \"debitor\" violates check constraint \"check_default_prefix\"");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user