introduce-separate-database-schemas-hs-booking-and-hosting #106

Merged
hsh-michaelhoennig merged 14 commits from introduce-separate-database-schemas-hs-booking-and-hosting into master 2024-09-23 10:52:39 +02:00
15 changed files with 65 additions and 65 deletions
Showing only changes of commit 77c22d0e55 - Show all commits

View File

@ -100,7 +100,7 @@ public class InsertTriggerGenerator {
/** /**
Grants ${rawSubTable} INSERT permission to specified role of new ${rawSuperTable} rows. Grants ${rawSubTable} INSERT permission to specified role of new ${rawSuperTable} rows.
*/ */
create or replace function ${rawSubTableSchemaPrefix}new_${rawSubTableShortName}_grants_insert_to_${rawSuperTableShortName}_tf() create or replace function ${rawSubTableSchemaPrefix}${rawSubTableShortName}_grants_insert_to_${rawSuperTableShortName}_tf()
returns trigger returns trigger
language plpgsql language plpgsql
strict as $$ strict as $$
@ -113,11 +113,11 @@ public class InsertTriggerGenerator {
return NEW; return NEW;
end; $$; end; $$;
-- z_... is to put it at the end of after insert triggers, to make sure the roles exist -- ..._z_... is to put it at the end of after insert triggers, to make sure the roles exist
create trigger z_new_${rawSubTableName}_grants_after_insert_tg create trigger ${rawSubTableName}_z_grants_after_insert_tg
after insert on ${rawSuperTableWithSchema} after insert on ${rawSuperTableWithSchema}
for each row for each row
execute procedure ${rawSubTableSchemaPrefix}new_${rawSubTableShortName}_grants_insert_to_${rawSuperTableShortName}_tf(); execute procedure ${rawSubTableSchemaPrefix}${rawSubTableShortName}_grants_insert_to_${rawSuperTableShortName}_tf();
""", """,
with("ifConditionThen", g.getSuperRoleDef().getEntityAlias().isCaseDependent() with("ifConditionThen", g.getSuperRoleDef().getEntityAlias().isCaseDependent()
// TODO.impl: .type needs to be dynamically generated // TODO.impl: .type needs to be dynamically generated

View File

@ -104,7 +104,7 @@ $$;
/** /**
Grants rbactest.customer INSERT permission to specified role of new global rows. Grants rbactest.customer INSERT permission to specified role of new global rows.
*/ */
create or replace function rbactest.new_customer_grants_insert_to_global_tf() create or replace function rbactest.customer_grants_insert_to_global_tf()
returns trigger returns trigger
language plpgsql language plpgsql
strict as $$ strict as $$
@ -117,11 +117,11 @@ begin
return NEW; return NEW;
end; $$; end; $$;
-- z_... is to put it at the end of after insert triggers, to make sure the roles exist -- ..._z_... is to put it at the end of after insert triggers, to make sure the roles exist
create trigger z_new_customer_grants_after_insert_tg create trigger customer_z_grants_after_insert_tg
after insert on rbac.global after insert on rbac.global
for each row for each row
execute procedure rbactest.new_customer_grants_insert_to_global_tf(); execute procedure rbactest.customer_grants_insert_to_global_tf();
-- ============================================================================ -- ============================================================================

View File

@ -169,7 +169,7 @@ $$;
/** /**
Grants rbactest.package INSERT permission to specified role of new customer rows. Grants rbactest.package INSERT permission to specified role of new customer rows.
*/ */
create or replace function rbactest.new_package_grants_insert_to_customer_tf() create or replace function rbactest.package_grants_insert_to_customer_tf()
returns trigger returns trigger
language plpgsql language plpgsql
strict as $$ strict as $$
@ -182,11 +182,11 @@ begin
return NEW; return NEW;
end; $$; end; $$;
-- z_... is to put it at the end of after insert triggers, to make sure the roles exist -- ..._z_... is to put it at the end of after insert triggers, to make sure the roles exist
create trigger z_new_package_grants_after_insert_tg create trigger package_z_grants_after_insert_tg
after insert on rbactest.customer after insert on rbactest.customer
for each row for each row
execute procedure rbactest.new_package_grants_insert_to_customer_tf(); execute procedure rbactest.package_grants_insert_to_customer_tf();
-- ============================================================================ -- ============================================================================

View File

@ -168,7 +168,7 @@ $$;
/** /**
Grants rbactest.domain INSERT permission to specified role of new package rows. Grants rbactest.domain INSERT permission to specified role of new package rows.
*/ */
create or replace function rbactest.new_domain_grants_insert_to_package_tf() create or replace function rbactest.domain_grants_insert_to_package_tf()
returns trigger returns trigger
language plpgsql language plpgsql
strict as $$ strict as $$
@ -181,11 +181,11 @@ begin
return NEW; return NEW;
end; $$; end; $$;
-- z_... is to put it at the end of after insert triggers, to make sure the roles exist -- ..._z_... is to put it at the end of after insert triggers, to make sure the roles exist
create trigger z_new_domain_grants_after_insert_tg create trigger domain_z_grants_after_insert_tg
after insert on rbactest.package after insert on rbactest.package
for each row for each row
execute procedure rbactest.new_domain_grants_insert_to_package_tf(); execute procedure rbactest.domain_grants_insert_to_package_tf();
-- ============================================================================ -- ============================================================================

View File

@ -178,7 +178,7 @@ $$;
/** /**
Grants hs_office.relation INSERT permission to specified role of new person rows. Grants hs_office.relation INSERT permission to specified role of new person rows.
*/ */
create or replace function hs_office.new_relation_grants_insert_to_person_tf() create or replace function hs_office.relation_grants_insert_to_person_tf()
returns trigger returns trigger
language plpgsql language plpgsql
strict as $$ strict as $$
@ -191,11 +191,11 @@ begin
return NEW; return NEW;
end; $$; end; $$;
-- z_... is to put it at the end of after insert triggers, to make sure the roles exist -- ..._z_... is to put it at the end of after insert triggers, to make sure the roles exist
create trigger z_new_relation_grants_after_insert_tg create trigger relation_z_grants_after_insert_tg
after insert on hs_office.person after insert on hs_office.person
for each row for each row
execute procedure hs_office.new_relation_grants_insert_to_person_tf(); execute procedure hs_office.relation_grants_insert_to_person_tf();
-- ============================================================================ -- ============================================================================

View File

@ -181,7 +181,7 @@ $$;
/** /**
Grants hs_office.partner INSERT permission to specified role of new global rows. Grants hs_office.partner INSERT permission to specified role of new global rows.
*/ */
create or replace function hs_office.new_partner_grants_insert_to_global_tf() create or replace function hs_office.partner_grants_insert_to_global_tf()
returns trigger returns trigger
language plpgsql language plpgsql
strict as $$ strict as $$
@ -194,11 +194,11 @@ begin
return NEW; return NEW;
end; $$; end; $$;
-- z_... is to put it at the end of after insert triggers, to make sure the roles exist -- ..._z_... is to put it at the end of after insert triggers, to make sure the roles exist
create trigger z_new_partner_grants_after_insert_tg create trigger partner_z_grants_after_insert_tg
after insert on rbac.global after insert on rbac.global
for each row for each row
execute procedure hs_office.new_partner_grants_insert_to_global_tf(); execute procedure hs_office.partner_grants_insert_to_global_tf();
-- ============================================================================ -- ============================================================================

View File

@ -85,7 +85,7 @@ $$;
/** /**
Grants hs_office.partner_details INSERT permission to specified role of new global rows. Grants hs_office.partner_details INSERT permission to specified role of new global rows.
*/ */
create or replace function hs_office.new_partner_details_grants_insert_to_global_tf() create or replace function hs_office.partner_details_grants_insert_to_global_tf()
returns trigger returns trigger
language plpgsql language plpgsql
strict as $$ strict as $$
@ -98,11 +98,11 @@ begin
return NEW; return NEW;
end; $$; end; $$;
-- z_... is to put it at the end of after insert triggers, to make sure the roles exist -- ..._z_... is to put it at the end of after insert triggers, to make sure the roles exist
create trigger z_new_partner_details_grants_after_insert_tg create trigger partner_details_z_grants_after_insert_tg
after insert on rbac.global after insert on rbac.global
for each row for each row
execute procedure hs_office.new_partner_details_grants_insert_to_global_tf(); execute procedure hs_office.partner_details_grants_insert_to_global_tf();
-- ============================================================================ -- ============================================================================

View File

@ -154,7 +154,7 @@ $$;
/** /**
Grants hs_office.debitor INSERT permission to specified role of new global rows. Grants hs_office.debitor INSERT permission to specified role of new global rows.
*/ */
create or replace function hs_office.new_debitor_grants_insert_to_global_tf() create or replace function hs_office.debitor_grants_insert_to_global_tf()
returns trigger returns trigger
language plpgsql language plpgsql
strict as $$ strict as $$
@ -167,11 +167,11 @@ begin
return NEW; return NEW;
end; $$; end; $$;
-- z_... is to put it at the end of after insert triggers, to make sure the roles exist -- ..._z_... is to put it at the end of after insert triggers, to make sure the roles exist
create trigger z_new_debitor_grants_after_insert_tg create trigger debitor_z_grants_after_insert_tg
after insert on rbac.global after insert on rbac.global
for each row for each row
execute procedure hs_office.new_debitor_grants_insert_to_global_tf(); execute procedure hs_office.debitor_grants_insert_to_global_tf();
-- ============================================================================ -- ============================================================================

View File

@ -129,7 +129,7 @@ $$;
/** /**
Grants hs_office.sepamandate INSERT permission to specified role of new relation rows. Grants hs_office.sepamandate INSERT permission to specified role of new relation rows.
*/ */
create or replace function hs_office.new_sepamandate_grants_insert_to_relation_tf() create or replace function hs_office.sepamandate_grants_insert_to_relation_tf()
returns trigger returns trigger
language plpgsql language plpgsql
strict as $$ strict as $$
@ -142,11 +142,11 @@ begin
return NEW; return NEW;
end; $$; end; $$;
-- z_... is to put it at the end of after insert triggers, to make sure the roles exist -- ..._z_... is to put it at the end of after insert triggers, to make sure the roles exist
create trigger z_new_sepamandate_grants_after_insert_tg create trigger sepamandate_z_grants_after_insert_tg
after insert on hs_office.relation after insert on hs_office.relation
for each row for each row
execute procedure hs_office.new_sepamandate_grants_insert_to_relation_tf(); execute procedure hs_office.sepamandate_grants_insert_to_relation_tf();
-- ============================================================================ -- ============================================================================

View File

@ -116,7 +116,7 @@ $$;
/** /**
Grants hs_office.membership INSERT permission to specified role of new global rows. Grants hs_office.membership INSERT permission to specified role of new global rows.
*/ */
create or replace function hs_office.new_membership_grants_insert_to_global_tf() create or replace function hs_office.membership_grants_insert_to_global_tf()
returns trigger returns trigger
language plpgsql language plpgsql
strict as $$ strict as $$
@ -129,11 +129,11 @@ begin
return NEW; return NEW;
end; $$; end; $$;
-- z_... is to put it at the end of after insert triggers, to make sure the roles exist -- ..._z_... is to put it at the end of after insert triggers, to make sure the roles exist
create trigger z_new_membership_grants_after_insert_tg create trigger membership_z_grants_after_insert_tg
after insert on rbac.global after insert on rbac.global
for each row for each row
execute procedure hs_office.new_membership_grants_insert_to_global_tf(); execute procedure hs_office.membership_grants_insert_to_global_tf();
-- ============================================================================ -- ============================================================================

View File

@ -92,7 +92,7 @@ $$;
/** /**
Grants hs_office.coopsharetx INSERT permission to specified role of new membership rows. Grants hs_office.coopsharetx INSERT permission to specified role of new membership rows.
*/ */
create or replace function hs_office.new_coopsharetx_grants_insert_to_membership_tf() create or replace function hs_office.coopsharetx_grants_insert_to_membership_tf()
returns trigger returns trigger
language plpgsql language plpgsql
strict as $$ strict as $$
@ -105,11 +105,11 @@ begin
return NEW; return NEW;
end; $$; end; $$;
-- z_... is to put it at the end of after insert triggers, to make sure the roles exist -- ..._z_... is to put it at the end of after insert triggers, to make sure the roles exist
create trigger z_new_coopsharetx_grants_after_insert_tg create trigger coopsharetx_z_grants_after_insert_tg
after insert on hs_office.membership after insert on hs_office.membership
for each row for each row
execute procedure hs_office.new_coopsharetx_grants_insert_to_membership_tf(); execute procedure hs_office.coopsharetx_grants_insert_to_membership_tf();
-- ============================================================================ -- ============================================================================

View File

@ -92,7 +92,7 @@ $$;
/** /**
Grants hs_office.coopassettx INSERT permission to specified role of new membership rows. Grants hs_office.coopassettx INSERT permission to specified role of new membership rows.
*/ */
create or replace function hs_office.new_coopassettx_grants_insert_to_membership_tf() create or replace function hs_office.coopassettx_grants_insert_to_membership_tf()
returns trigger returns trigger
language plpgsql language plpgsql
strict as $$ strict as $$
@ -105,11 +105,11 @@ begin
return NEW; return NEW;
end; $$; end; $$;
-- z_... is to put it at the end of after insert triggers, to make sure the roles exist -- ..._z_... is to put it at the end of after insert triggers, to make sure the roles exist
create trigger z_new_coopassettx_grants_after_insert_tg create trigger coopassettx_z_grants_after_insert_tg
after insert on hs_office.membership after insert on hs_office.membership
for each row for each row
execute procedure hs_office.new_coopassettx_grants_insert_to_membership_tf(); execute procedure hs_office.coopassettx_grants_insert_to_membership_tf();
-- ============================================================================ -- ============================================================================

View File

@ -123,7 +123,7 @@ $$;
/** /**
Grants hs_booking.project INSERT permission to specified role of new relation rows. Grants hs_booking.project INSERT permission to specified role of new relation rows.
*/ */
create or replace function hs_booking.new_project_grants_insert_to_relation_tf() create or replace function hs_booking.project_grants_insert_to_relation_tf()
returns trigger returns trigger
language plpgsql language plpgsql
strict as $$ strict as $$
@ -136,11 +136,11 @@ begin
return NEW; return NEW;
end; $$; end; $$;
-- z_... is to put it at the end of after insert triggers, to make sure the roles exist -- ..._z_... is to put it at the end of after insert triggers, to make sure the roles exist
create trigger z_new_project_grants_after_insert_tg create trigger project_z_grants_after_insert_tg
after insert on hs_office.relation after insert on hs_office.relation
for each row for each row
execute procedure hs_booking.new_project_grants_insert_to_relation_tf(); execute procedure hs_booking.project_grants_insert_to_relation_tf();
-- ============================================================================ -- ============================================================================

View File

@ -122,7 +122,7 @@ $$;
/** /**
Grants hs_booking.item INSERT permission to specified role of new global rows. Grants hs_booking.item INSERT permission to specified role of new global rows.
*/ */
create or replace function hs_booking.new_item_grants_insert_to_global_tf() create or replace function hs_booking.item_grants_insert_to_global_tf()
returns trigger returns trigger
language plpgsql language plpgsql
strict as $$ strict as $$
@ -135,11 +135,11 @@ begin
return NEW; return NEW;
end; $$; end; $$;
-- z_... is to put it at the end of after insert triggers, to make sure the roles exist -- ..._z_... is to put it at the end of after insert triggers, to make sure the roles exist
create trigger z_new_item_grants_after_insert_tg create trigger item_z_grants_after_insert_tg
after insert on rbac.global after insert on rbac.global
for each row for each row
execute procedure hs_booking.new_item_grants_insert_to_global_tf(); execute procedure hs_booking.item_grants_insert_to_global_tf();
-- granting INSERT permission to hs_booking.project ---------------------------- -- granting INSERT permission to hs_booking.project ----------------------------
@ -165,7 +165,7 @@ $$;
/** /**
Grants hs_booking.item INSERT permission to specified role of new project rows. Grants hs_booking.item INSERT permission to specified role of new project rows.
*/ */
create or replace function hs_booking.new_item_grants_insert_to_project_tf() create or replace function hs_booking.item_grants_insert_to_project_tf()
returns trigger returns trigger
language plpgsql language plpgsql
strict as $$ strict as $$
@ -178,11 +178,11 @@ begin
return NEW; return NEW;
end; $$; end; $$;
-- z_... is to put it at the end of after insert triggers, to make sure the roles exist -- ..._z_... is to put it at the end of after insert triggers, to make sure the roles exist
create trigger z_new_item_grants_after_insert_tg create trigger item_z_grants_after_insert_tg
after insert on hs_booking.project after insert on hs_booking.project
for each row for each row
execute procedure hs_booking.new_item_grants_insert_to_project_tf(); execute procedure hs_booking.item_grants_insert_to_project_tf();
-- granting INSERT permission to hs_booking.item ---------------------------- -- granting INSERT permission to hs_booking.item ----------------------------
@ -192,7 +192,7 @@ execute procedure hs_booking.new_item_grants_insert_to_project_tf();
/** /**
Grants hs_booking.item INSERT permission to specified role of new item rows. Grants hs_booking.item INSERT permission to specified role of new item rows.
*/ */
create or replace function hs_booking.new_item_grants_insert_to_item_tf() create or replace function hs_booking.item_grants_insert_to_item_tf()
returns trigger returns trigger
language plpgsql language plpgsql
strict as $$ strict as $$
@ -205,11 +205,11 @@ begin
return NEW; return NEW;
end; $$; end; $$;
-- z_... is to put it at the end of after insert triggers, to make sure the roles exist -- ..._z_... is to put it at the end of after insert triggers, to make sure the roles exist
create trigger z_new_item_grants_after_insert_tg create trigger item_z_grants_after_insert_tg
after insert on hs_booking.item after insert on hs_booking.item
for each row for each row
execute procedure hs_booking.new_item_grants_insert_to_item_tf(); execute procedure hs_booking.item_grants_insert_to_item_tf();
-- ============================================================================ -- ============================================================================

View File

@ -7,7 +7,7 @@ spring:
url-tc: jdbc:tc:postgresql:15.5-bookworm:///spring_boot_testcontainers url-tc: jdbc:tc:postgresql:15.5-bookworm:///spring_boot_testcontainers
url-tcx: jdbc:tc:postgresql:15.5-bookworm:///spring_boot_testcontainers?TC_REUSABLE=true&TC_DAEMON=true url-tcx: jdbc:tc:postgresql:15.5-bookworm:///spring_boot_testcontainers?TC_REUSABLE=true&TC_DAEMON=true
url-local: jdbc:postgresql://localhost:5432/postgres url-local: jdbc:postgresql://localhost:5432/postgres
url: ${spring.datasource.url-local} url: ${spring.datasource.url-tc}
username: postgres username: postgres
password: password password: password