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
20 changed files with 100 additions and 102 deletions
Showing only changes of commit a0e1d96278 - Show all commits

View File

@ -7,7 +7,7 @@
/* /*
Generates a customer reference number for a given test data counter. Generates a customer reference number for a given test data counter.
*/ */
create or replace function testCustomerReference(customerCount integer) create or replace function rbactest.testCustomerReference(customerCount integer)
returns integer returns integer
returns null on null input returns null on null input
language plpgsql as $$ language plpgsql as $$
@ -19,7 +19,7 @@ end; $$;
/* /*
Creates a single customer test record with dist. Creates a single customer test record with dist.
*/ */
create or replace procedure createTestCustomerTestData( create or replace procedure rbactest.createTestCustomerTestData(
custReference integer, custReference integer,
custPrefix varchar custPrefix varchar
) )
@ -51,7 +51,7 @@ end; $$;
/* /*
Creates a range of test customers for mass data generation. Creates a range of test customers for mass data generation.
*/ */
create or replace procedure createTestCustomerTestData( create or replace procedure rbactest.createTestCustomerTestData(
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
) )
@ -59,7 +59,7 @@ create or replace procedure createTestCustomerTestData(
begin begin
for t in startCount..endCount for t in startCount..endCount
loop loop
call createTestCustomerTestData(testCustomerReference(t), base.intToVarChar(t, 3)); call rbactest.createTestCustomerTestData(rbactest.testCustomerReference(t), base.intToVarChar(t, 3));
commit; commit;
end loop; end loop;
end; $$; end; $$;
@ -74,9 +74,9 @@ do language plpgsql $$
begin begin
call base.defineContext('creating RBAC test customer', null, 'superuser-alex@hostsharing.net', 'rbac.global#global:ADMIN'); call base.defineContext('creating RBAC test customer', null, 'superuser-alex@hostsharing.net', 'rbac.global#global:ADMIN');
call createTestCustomerTestData(99901, 'xxx'); call rbactest.createTestCustomerTestData(99901, 'xxx');
call createTestCustomerTestData(99902, 'yyy'); call rbactest.createTestCustomerTestData(99902, 'yyy');
call createTestCustomerTestData(99903, 'zzz'); call rbactest.createTestCustomerTestData(99903, 'zzz');
end; end;
$$; $$;
--// --//

View File

@ -6,7 +6,7 @@
/* /*
Creates the given number of test packages for the given customer. Creates the given number of test packages for the given customer.
*/ */
create or replace procedure createPackageTestData(customerPrefix varchar, pacCount int) create or replace procedure rbactest.createPackageTestData(customerPrefix varchar, pacCount int)
language plpgsql as $$ language plpgsql as $$
declare declare
cust rbactest.customer; cust rbactest.customer;
@ -41,7 +41,7 @@ end; $$;
/* /*
Creates a range of test packages for mass data generation. Creates a range of test packages for mass data generation.
*/ */
create or replace procedure createPackageTestData() create or replace procedure rbactest.createPackageTestData()
language plpgsql as $$ language plpgsql as $$
declare declare
cust rbactest.customer; cust rbactest.customer;
@ -49,7 +49,7 @@ begin
for cust in (select * from rbactest.customer) for cust in (select * from rbactest.customer)
loop loop
continue when cust.reference >= 90000; -- reserved for functional testing continue when cust.reference >= 90000; -- reserved for functional testing
call createPackageTestData(cust.prefix, 3); call rbactest.createPackageTestData(cust.prefix, 3);
end loop; end loop;
commit; commit;
@ -64,9 +64,9 @@ $$;
do language plpgsql $$ do language plpgsql $$
begin begin
call createPackageTestData('xxx', 3); call rbactest.createPackageTestData('xxx', 3);
call createPackageTestData('yyy', 3); call rbactest.createPackageTestData('yyy', 3);
call createPackageTestData('zzz', 3); call rbactest.createPackageTestData('zzz', 3);
end; end;
$$; $$;
--// --//

View File

@ -6,7 +6,7 @@
/* /*
Creates the given count of test unix users for a single package. Creates the given count of test unix users for a single package.
*/ */
create or replace procedure createdomainTestData( packageName varchar, domainCount int ) create or replace procedure rbactest.createDomainTestData( packageName varchar, domainCount int )
language plpgsql as $$ language plpgsql as $$
declare declare
pac record; pac record;
@ -32,12 +32,10 @@ end; $$;
/* /*
Creates a range of unix users for mass data generation. Creates a range of unix users for mass data generation.
*/ */
create or replace procedure createdomainTestData( domainPerPackage integer ) create or replace procedure rbactest.createDomainTestData( domainPerPackage integer )
language plpgsql as $$ language plpgsql as $$
declare declare
pac record; pac record;
pacAdmin varchar;
currentTask varchar;
begin begin
for pac in for pac in
(select p.uuid, p.name (select p.uuid, p.name
@ -45,7 +43,7 @@ begin
join rbactest.customer c on p.customeruuid = c.uuid join rbactest.customer c on p.customeruuid = c.uuid
where c.reference < 90000) -- reserved for functional testing where c.reference < 90000) -- reserved for functional testing
loop loop
call createdomainTestData(pac.name, 2); call rbactest.createdomainTestData(pac.name, 2);
commit; commit;
end loop; end loop;
@ -59,17 +57,17 @@ end; $$;
do language plpgsql $$ do language plpgsql $$
begin begin
call createdomainTestData('xxx00', 2); call rbactest.createDomainTestData('xxx00', 2);
call createdomainTestData('xxx01', 2); call rbactest.createDomainTestData('xxx01', 2);
call createdomainTestData('xxx02', 2); call rbactest.createDomainTestData('xxx02', 2);
call createdomainTestData('yyy00', 2); call rbactest.createDomainTestData('yyy00', 2);
call createdomainTestData('yyy01', 2); call rbactest.createDomainTestData('yyy01', 2);
call createdomainTestData('yyy02', 2); call rbactest.createDomainTestData('yyy02', 2);
call createdomainTestData('zzz00', 2); call rbactest.createDomainTestData('zzz00', 2);
call createdomainTestData('zzz01', 2); call rbactest.createDomainTestData('zzz01', 2);
call createdomainTestData('zzz02', 2); call rbactest.createDomainTestData('zzz02', 2);
end; end;
$$; $$;
--// --//

View File

@ -8,7 +8,7 @@
/* /*
Creates a single contact test record. Creates a single contact test record.
*/ */
create or replace procedure createHsOfficeContactTestData(contCaption varchar) create or replace procedure hs_office.createHsOfficeContactTestData(contCaption varchar)
language plpgsql as $$ language plpgsql as $$
declare declare
postalAddr varchar; postalAddr varchar;
@ -36,7 +36,7 @@ end; $$;
/* /*
Creates a range of test contact for mass data generation. Creates a range of test contact for mass data generation.
*/ */
create or replace procedure createHsOfficeContactTestData( create or replace procedure hs_office.createHsOfficeContactTestData(
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
) )
@ -44,7 +44,7 @@ create or replace procedure createHsOfficeContactTestData(
begin begin
for t in startCount..endCount for t in startCount..endCount
loop loop
call createHsOfficeContactTestData(base.intToVarChar(t, 4) || '#' || t); call hs_office.createHsOfficeContactTestData(base.intToVarChar(t, 4) || '#' || t);
commit; commit;
end loop; end loop;
end; $$; end; $$;
@ -58,18 +58,18 @@ end; $$;
do language plpgsql $$ do language plpgsql $$
begin begin
-- TODO: use better names -- TODO: use better names
call createHsOfficeContactTestData('first contact'); call hs_office.createHsOfficeContactTestData('first contact');
call createHsOfficeContactTestData('second contact'); call hs_office.createHsOfficeContactTestData('second contact');
call createHsOfficeContactTestData('third contact'); call hs_office.createHsOfficeContactTestData('third contact');
call createHsOfficeContactTestData('fourth contact'); call hs_office.createHsOfficeContactTestData('fourth contact');
call createHsOfficeContactTestData('fifth contact'); call hs_office.createHsOfficeContactTestData('fifth contact');
call createHsOfficeContactTestData('sixth contact'); call hs_office.createHsOfficeContactTestData('sixth contact');
call createHsOfficeContactTestData('seventh contact'); call hs_office.createHsOfficeContactTestData('seventh contact');
call createHsOfficeContactTestData('eighth contact'); call hs_office.createHsOfficeContactTestData('eighth contact');
call createHsOfficeContactTestData('ninth contact'); call hs_office.createHsOfficeContactTestData('ninth contact');
call createHsOfficeContactTestData('tenth contact'); call hs_office.createHsOfficeContactTestData('tenth contact');
call createHsOfficeContactTestData('eleventh contact'); call hs_office.createHsOfficeContactTestData('eleventh contact');
call createHsOfficeContactTestData('twelfth contact'); call hs_office.createHsOfficeContactTestData('twelfth contact');
end; end;
$$; $$;
--// --//

View File

@ -4,7 +4,7 @@
--changeset michael.hoennig:hs-office-person-MAIN-TABLE endDelimiter:--// --changeset michael.hoennig:hs-office-person-MAIN-TABLE endDelimiter:--//
-- ---------------------------------------------------------------------------- -- ----------------------------------------------------------------------------
CREATE TYPE HsOfficePersonType AS ENUM ( CREATE TYPE hs_office.HsOfficePersonType AS ENUM (
'??', -- unknown '??', -- unknown
'NP', -- natural person 'NP', -- natural person
'LP', -- legal person 'LP', -- legal person
@ -12,13 +12,13 @@ CREATE TYPE HsOfficePersonType AS ENUM (
'UF', -- unincorporated firm 'UF', -- unincorporated firm
'PI'); -- public institution 'PI'); -- public institution
CREATE CAST (character varying as HsOfficePersonType) WITH INOUT AS IMPLICIT; CREATE CAST (character varying as hs_office.HsOfficePersonType) WITH INOUT AS IMPLICIT;
create table if not exists hs_office.person create table if not exists hs_office.person
( (
uuid uuid unique references rbac.object (uuid) initially deferred, uuid uuid unique references rbac.object (uuid) initially deferred,
version int not null default 0, version int not null default 0,
personType HsOfficePersonType not null, personType hs_office.HsOfficePersonType not null,
tradeName varchar(96), tradeName varchar(96),
salutation varchar(30), salutation varchar(30),
title varchar(20), title varchar(20),

View File

@ -9,7 +9,7 @@
Creates a single person test record. Creates a single person test record.
*/ */
create or replace procedure createHsOfficePersonTestData( create or replace procedure createHsOfficePersonTestData(
newPersonType HsOfficePersonType, newPersonType hs_office.HsOfficePersonType,
newTradeName varchar, newTradeName varchar,
newFamilyName varchar = null, newFamilyName varchar = null,
newGivenName varchar = null newGivenName varchar = null

View File

@ -4,7 +4,7 @@
--changeset michael.hoennig:hs-office-relation-MAIN-TABLE endDelimiter:--// --changeset michael.hoennig:hs-office-relation-MAIN-TABLE endDelimiter:--//
-- ---------------------------------------------------------------------------- -- ----------------------------------------------------------------------------
CREATE TYPE HsOfficeRelationType AS ENUM ( CREATE TYPE hs_office.HsOfficeRelationType AS ENUM (
'UNKNOWN', 'UNKNOWN',
'PARTNER', 'PARTNER',
'EX_PARTNER', 'EX_PARTNER',
@ -14,7 +14,7 @@ CREATE TYPE HsOfficeRelationType AS ENUM (
'OPERATIONS', 'OPERATIONS',
'SUBSCRIBER'); 'SUBSCRIBER');
CREATE CAST (character varying as HsOfficeRelationType) WITH INOUT AS IMPLICIT; CREATE CAST (character varying as hs_office.HsOfficeRelationType) WITH INOUT AS IMPLICIT;
create table if not exists hs_office.relation create table if not exists hs_office.relation
( (
@ -23,7 +23,7 @@ create table if not exists hs_office.relation
anchorUuid uuid not null references hs_office.person(uuid), anchorUuid uuid not null references hs_office.person(uuid),
holderUuid uuid not null references hs_office.person(uuid), holderUuid uuid not null references hs_office.person(uuid),
contactUuid uuid references hs_office.contact(uuid), contactUuid uuid references hs_office.contact(uuid),
type HsOfficeRelationType not null, type hs_office.HsOfficeRelationType not null,
mark varchar(24) mark varchar(24)
); );
--// --//

View File

@ -10,7 +10,7 @@
*/ */
create or replace procedure createHsOfficeRelationTestData( create or replace procedure createHsOfficeRelationTestData(
holderPersonName varchar, holderPersonName varchar,
relationType HsOfficeRelationType, relationType hs_office.HsOfficeRelationType,
anchorPersonName varchar, anchorPersonName varchar,
contactCaption varchar, contactCaption varchar,
mark varchar default null) mark varchar default null)

View File

@ -8,7 +8,7 @@
/* /*
Creates a single partner test record. Creates a single partner test record.
*/ */
create or replace procedure createHsOfficePartnerTestData( create or replace procedure hs_office.createHsOfficePartnerTestData(
mandantTradeName varchar, mandantTradeName varchar,
newPartnerNumber numeric(5), newPartnerNumber numeric(5),
partnerPersonName varchar, partnerPersonName varchar,
@ -73,11 +73,11 @@ do language plpgsql $$
begin begin
call base.defineContext('creating partner test-data ', null, 'superuser-alex@hostsharing.net', 'rbac.global#global:ADMIN'); call base.defineContext('creating partner test-data ', null, 'superuser-alex@hostsharing.net', 'rbac.global#global:ADMIN');
call createHsOfficePartnerTestData('Hostsharing eG', 10001, 'First GmbH', 'first contact'); call hs_office.createHsOfficePartnerTestData('Hostsharing eG', 10001, 'First GmbH', 'first contact');
call createHsOfficePartnerTestData('Hostsharing eG', 10002, 'Second e.K.', 'second contact'); call hs_office.createHsOfficePartnerTestData('Hostsharing eG', 10002, 'Second e.K.', 'second contact');
call createHsOfficePartnerTestData('Hostsharing eG', 10003, 'Third OHG', 'third contact'); call hs_office.createHsOfficePartnerTestData('Hostsharing eG', 10003, 'Third OHG', 'third contact');
call createHsOfficePartnerTestData('Hostsharing eG', 10004, 'Fourth eG', 'fourth contact'); call hs_office.createHsOfficePartnerTestData('Hostsharing eG', 10004, 'Fourth eG', 'fourth contact');
call createHsOfficePartnerTestData('Hostsharing eG', 10010, 'Smith', 'fifth contact'); call hs_office.createHsOfficePartnerTestData('Hostsharing eG', 10010, 'Smith', 'fifth contact');
end; end;
$$; $$;
--// --//

View File

@ -8,7 +8,7 @@
/* /*
Creates a single bankaccount test record. Creates a single bankaccount test record.
*/ */
create or replace procedure createHsOfficeBankAccountTestData(givenHolder varchar, givenIBAN varchar, givenBIC varchar) create or replace procedure hs_office.createHsOfficeBankAccountTestData(givenHolder varchar, givenIBAN varchar, givenBIC varchar)
language plpgsql as $$ language plpgsql as $$
declare declare
emailAddr varchar; emailAddr varchar;
@ -34,13 +34,13 @@ do language plpgsql $$
call base.defineContext('creating bankaccount test-data'); call base.defineContext('creating bankaccount test-data');
-- IBANs+BICs taken from https://ibanvalidieren.de/beispiele.html -- IBANs+BICs taken from https://ibanvalidieren.de/beispiele.html
call createHsOfficeBankAccountTestData('First GmbH', 'DE02120300000000202051', 'BYLADEM1001'); call hs_office.createHsOfficeBankAccountTestData('First GmbH', 'DE02120300000000202051', 'BYLADEM1001');
call createHsOfficeBankAccountTestData('Peter Smith', 'DE02500105170137075030', 'INGDDEFF'); call hs_office.createHsOfficeBankAccountTestData('Peter Smith', 'DE02500105170137075030', 'INGDDEFF');
call createHsOfficeBankAccountTestData('Second e.K.', 'DE02100500000054540402', 'BELADEBE'); call hs_office.createHsOfficeBankAccountTestData('Second e.K.', 'DE02100500000054540402', 'BELADEBE');
call createHsOfficeBankAccountTestData('Third OHG', 'DE02300209000106531065', 'CMCIDEDD'); call hs_office.createHsOfficeBankAccountTestData('Third OHG', 'DE02300209000106531065', 'CMCIDEDD');
call createHsOfficeBankAccountTestData('Fourth eG', 'DE02200505501015871393', 'HASPDEHH'); call hs_office.createHsOfficeBankAccountTestData('Fourth eG', 'DE02200505501015871393', 'HASPDEHH');
call createHsOfficeBankAccountTestData('Mel Bessler', 'DE02100100100006820101', 'PBNKDEFF'); call hs_office.createHsOfficeBankAccountTestData('Mel Bessler', 'DE02100100100006820101', 'PBNKDEFF');
call createHsOfficeBankAccountTestData('Anita Bessler', 'DE02300606010002474689', 'DAAEDEDD'); call hs_office.createHsOfficeBankAccountTestData('Anita Bessler', 'DE02300606010002474689', 'DAAEDEDD');
call createHsOfficeBankAccountTestData('Paul Winkler', 'DE02600501010002034304', 'SOLADEST600'); call hs_office.createHsOfficeBankAccountTestData('Paul Winkler', 'DE02600501010002034304', 'SOLADEST600');
end; end;
$$; $$;

View File

@ -8,7 +8,7 @@
/* /*
Creates a single debitor test record. Creates a single debitor test record.
*/ */
create or replace procedure createHsOfficeDebitorTestData( create or replace procedure hs_office.createHsOfficeDebitorTestData(
withDebitorNumberSuffix numeric(5), withDebitorNumberSuffix numeric(5),
forPartnerPersonName varchar, forPartnerPersonName varchar,
forBillingContactCaption varchar, forBillingContactCaption varchar,
@ -52,9 +52,9 @@ do language plpgsql $$
begin begin
call base.defineContext('creating debitor test-data', null, 'superuser-alex@hostsharing.net', 'rbac.global#global:ADMIN'); call base.defineContext('creating debitor test-data', null, 'superuser-alex@hostsharing.net', 'rbac.global#global:ADMIN');
call createHsOfficeDebitorTestData(11, 'First GmbH', 'first contact', 'fir'); call hs_office.createHsOfficeDebitorTestData(11, 'First GmbH', 'first contact', 'fir');
call createHsOfficeDebitorTestData(12, 'Second e.K.', 'second contact', 'sec'); call hs_office.createHsOfficeDebitorTestData(12, 'Second e.K.', 'second contact', 'sec');
call createHsOfficeDebitorTestData(13, 'Third OHG', 'third contact', 'thi'); call hs_office.createHsOfficeDebitorTestData(13, 'Third OHG', 'third contact', 'thi');
end; end;
$$; $$;
--// --//

View File

@ -8,7 +8,7 @@
/* /*
Creates a single sepaMandate test record. Creates a single sepaMandate test record.
*/ */
create or replace procedure createHsOfficeSepaMandateTestData( create or replace procedure hs_office.createHsOfficeSepaMandateTestData(
forPartnerNumber numeric(5), forPartnerNumber numeric(5),
forDebitorSuffix char(2), forDebitorSuffix char(2),
forIban varchar, forIban varchar,
@ -45,9 +45,9 @@ do language plpgsql $$
begin begin
call base.defineContext('creating SEPA-mandate test-data', null, 'superuser-alex@hostsharing.net', 'rbac.global#global:ADMIN'); call base.defineContext('creating SEPA-mandate test-data', null, 'superuser-alex@hostsharing.net', 'rbac.global#global:ADMIN');
call createHsOfficeSepaMandateTestData(10001, '11', 'DE02120300000000202051', 'ref-10001-11'); call hs_office.createHsOfficeSepaMandateTestData(10001, '11', 'DE02120300000000202051', 'ref-10001-11');
call createHsOfficeSepaMandateTestData(10002, '12', 'DE02100500000054540402', 'ref-10002-12'); call hs_office.createHsOfficeSepaMandateTestData(10002, '12', 'DE02100500000054540402', 'ref-10002-12');
call createHsOfficeSepaMandateTestData(10003, '13', 'DE02300209000106531065', 'ref-10003-13'); call hs_office.createHsOfficeSepaMandateTestData(10003, '13', 'DE02300209000106531065', 'ref-10003-13');
end; end;
$$; $$;
--// --//

View File

@ -4,7 +4,7 @@
--changeset michael.hoennig:hs-office-membership-MAIN-TABLE endDelimiter:--// --changeset michael.hoennig:hs-office-membership-MAIN-TABLE endDelimiter:--//
-- ---------------------------------------------------------------------------- -- ----------------------------------------------------------------------------
CREATE TYPE HsOfficeMembershipStatus AS ENUM ( CREATE TYPE hs_office.HsOfficeMembershipStatus AS ENUM (
'INVALID', 'INVALID',
'ACTIVE', 'ACTIVE',
'CANCELLED', 'CANCELLED',
@ -15,7 +15,7 @@ CREATE TYPE HsOfficeMembershipStatus AS ENUM (
'UNKNOWN' 'UNKNOWN'
); );
CREATE CAST (character varying as HsOfficeMembershipStatus) WITH INOUT AS IMPLICIT; CREATE CAST (character varying as hs_office.HsOfficeMembershipStatus) WITH INOUT AS IMPLICIT;
create table if not exists hs_office.membership create table if not exists hs_office.membership
( (
@ -24,7 +24,7 @@ create table if not exists hs_office.membership
partnerUuid uuid not null references hs_office.partner(uuid), partnerUuid uuid not null references hs_office.partner(uuid),
memberNumberSuffix char(2) not null check (memberNumberSuffix::text ~ '^[0-9][0-9]$'), memberNumberSuffix char(2) not null check (memberNumberSuffix::text ~ '^[0-9][0-9]$'),
validity daterange not null, validity daterange not null,
status HsOfficeMembershipStatus not null default 'ACTIVE', status hs_office.HsOfficeMembershipStatus not null default 'ACTIVE',
membershipFeeBillable boolean not null default true, membershipFeeBillable boolean not null default true,
UNIQUE(partnerUuid, memberNumberSuffix) UNIQUE(partnerUuid, memberNumberSuffix)

View File

@ -8,7 +8,7 @@
/* /*
Creates a single membership test record. Creates a single membership test record.
*/ */
create or replace procedure createHsOfficeMembershipTestData( create or replace procedure hs_office.createHsOfficeMembershipTestData(
forPartnerNumber numeric(5), forPartnerNumber numeric(5),
newMemberNumberSuffix char(2) ) newMemberNumberSuffix char(2) )
language plpgsql as $$ language plpgsql as $$
@ -35,9 +35,9 @@ do language plpgsql $$
begin begin
call base.defineContext('creating Membership test-data', null, 'superuser-alex@hostsharing.net', 'rbac.global#global:ADMIN'); call base.defineContext('creating Membership test-data', null, 'superuser-alex@hostsharing.net', 'rbac.global#global:ADMIN');
call createHsOfficeMembershipTestData(10001, '01'); call hs_office.createHsOfficeMembershipTestData(10001, '01');
call createHsOfficeMembershipTestData(10002, '02'); call hs_office.createHsOfficeMembershipTestData(10002, '02');
call createHsOfficeMembershipTestData(10003, '03'); call hs_office.createHsOfficeMembershipTestData(10003, '03');
end; end;
$$; $$;
--// --//

View File

@ -4,16 +4,16 @@
--changeset michael.hoennig:hs-office-coopshares-MAIN-TABLE endDelimiter:--// --changeset michael.hoennig:hs-office-coopshares-MAIN-TABLE endDelimiter:--//
-- ---------------------------------------------------------------------------- -- ----------------------------------------------------------------------------
CREATE TYPE HsOfficeCoopSharesTransactionType AS ENUM ('ADJUSTMENT', 'SUBSCRIPTION', 'CANCELLATION'); CREATE TYPE hs_office.HsOfficeCoopSharesTransactionType AS ENUM ('ADJUSTMENT', 'SUBSCRIPTION', 'CANCELLATION');
CREATE CAST (character varying as HsOfficeCoopSharesTransactionType) WITH INOUT AS IMPLICIT; CREATE CAST (character varying as hs_office.HsOfficeCoopSharesTransactionType) WITH INOUT AS IMPLICIT;
create table if not exists hs_office.coopsharestransaction create table if not exists hs_office.coopsharestransaction
( (
uuid uuid unique references rbac.object (uuid) initially deferred, uuid uuid unique references rbac.object (uuid) initially deferred,
version int not null default 0, version int not null default 0,
membershipUuid uuid not null references hs_office.membership(uuid), membershipUuid uuid not null references hs_office.membership(uuid),
transactionType HsOfficeCoopSharesTransactionType not null, transactionType hs_office.HsOfficeCoopSharesTransactionType not null,
valueDate date not null, valueDate date not null,
shareCount integer not null, shareCount integer not null,
reference varchar(48) not null, reference varchar(48) not null,

View File

@ -8,7 +8,7 @@
/* /*
Creates a single coopSharesTransaction test record. Creates a single coopSharesTransaction test record.
*/ */
create or replace procedure createHsOfficeCoopSharesTransactionTestData( create or replace procedure hs_office.createHsOfficeCoopSharesTransactionTestData(
givenPartnerNumber numeric, givenPartnerNumber numeric,
givenMemberNumberSuffix char(2) givenMemberNumberSuffix char(2)
) )
@ -46,8 +46,8 @@ do language plpgsql $$
call base.defineContext('creating coopSharesTransaction test-data'); call base.defineContext('creating coopSharesTransaction test-data');
SET CONSTRAINTS ALL DEFERRED; SET CONSTRAINTS ALL DEFERRED;
call createHsOfficeCoopSharesTransactionTestData(10001, '01'); call hs_office.createHsOfficeCoopSharesTransactionTestData(10001, '01');
call createHsOfficeCoopSharesTransactionTestData(10002, '02'); call hs_office.createHsOfficeCoopSharesTransactionTestData(10002, '02');
call createHsOfficeCoopSharesTransactionTestData(10003, '03'); call hs_office.createHsOfficeCoopSharesTransactionTestData(10003, '03');
end; end;
$$; $$;

View File

@ -4,7 +4,7 @@
--changeset michael.hoennig:hs-office-coopassets-MAIN-TABLE endDelimiter:--// --changeset michael.hoennig:hs-office-coopassets-MAIN-TABLE endDelimiter:--//
-- ---------------------------------------------------------------------------- -- ----------------------------------------------------------------------------
CREATE TYPE HsOfficeCoopAssetsTransactionType AS ENUM ('ADJUSTMENT', CREATE TYPE hs_office.HsOfficeCoopAssetsTransactionType AS ENUM ('ADJUSTMENT',
'DEPOSIT', 'DEPOSIT',
'DISBURSAL', 'DISBURSAL',
'TRANSFER', 'TRANSFER',
@ -13,14 +13,14 @@ CREATE TYPE HsOfficeCoopAssetsTransactionType AS ENUM ('ADJUSTMENT',
'LOSS', 'LOSS',
'LIMITATION'); 'LIMITATION');
CREATE CAST (character varying as HsOfficeCoopAssetsTransactionType) WITH INOUT AS IMPLICIT; CREATE CAST (character varying as hs_office.HsOfficeCoopAssetsTransactionType) WITH INOUT AS IMPLICIT;
create table if not exists hs_office.coopassetstransaction create table if not exists hs_office.coopassetstransaction
( (
uuid uuid unique references rbac.object (uuid) initially deferred, uuid uuid unique references rbac.object (uuid) initially deferred,
version int not null default 0, version int not null default 0,
membershipUuid uuid not null references hs_office.membership(uuid), membershipUuid uuid not null references hs_office.membership(uuid),
transactionType HsOfficeCoopAssetsTransactionType not null, transactionType hs_office.HsOfficeCoopAssetsTransactionType not null,
valueDate date not null, valueDate date not null,
assetValue money not null, assetValue money not null,
reference varchar(48) not null, reference varchar(48) not null,

View File

@ -8,7 +8,7 @@
/* /*
Creates a single coopAssetsTransaction test record. Creates a single coopAssetsTransaction test record.
*/ */
create or replace procedure createHsOfficeCoopAssetsTransactionTestData( create or replace procedure hs_office.createHsOfficeCoopAssetsTransactionTestData(
givenPartnerNumber numeric, givenPartnerNumber numeric,
givenMemberNumberSuffix char(2) givenMemberNumberSuffix char(2)
) )
@ -46,8 +46,8 @@ do language plpgsql $$
call base.defineContext('creating coopAssetsTransaction test-data'); call base.defineContext('creating coopAssetsTransaction test-data');
SET CONSTRAINTS ALL DEFERRED; SET CONSTRAINTS ALL DEFERRED;
call createHsOfficeCoopAssetsTransactionTestData(10001, '01'); call hs_office.createHsOfficeCoopAssetsTransactionTestData(10001, '01');
call createHsOfficeCoopAssetsTransactionTestData(10002, '02'); call hs_office.createHsOfficeCoopAssetsTransactionTestData(10002, '02');
call createHsOfficeCoopAssetsTransactionTestData(10003, '03'); call hs_office.createHsOfficeCoopAssetsTransactionTestData(10003, '03');
end; end;
$$; $$;

View File

@ -8,7 +8,7 @@
/* /*
Creates a single hs_booking.item test record. Creates a single hs_booking.item test record.
*/ */
create or replace procedure createHsBookingItemTransactionTestData( create or replace procedure hs_booking.createHsBookingItemTransactionTestData(
givenPartnerNumber numeric, givenPartnerNumber numeric,
givenDebitorSuffix char(2) givenDebitorSuffix char(2)
) )
@ -49,9 +49,9 @@ do language plpgsql $$
begin begin
call base.defineContext('creating booking-item test-data', null, 'superuser-alex@hostsharing.net', 'rbac.global#global:ADMIN'); call base.defineContext('creating booking-item test-data', null, 'superuser-alex@hostsharing.net', 'rbac.global#global:ADMIN');
call createHsBookingItemTransactionTestData(10001, '11'); call hs_booking.createHsBookingItemTransactionTestData(10001, '11');
call createHsBookingItemTransactionTestData(10002, '12'); call hs_booking.createHsBookingItemTransactionTestData(10002, '12');
call createHsBookingItemTransactionTestData(10003, '13'); call hs_booking.createHsBookingItemTransactionTestData(10003, '13');
end; end;
$$; $$;
--// --//

View File

@ -8,7 +8,7 @@
/* /*
Creates a single hs_hosting.asset test record. Creates a single hs_hosting.asset test record.
*/ */
create or replace procedure createHsHostingAssetTestData(givenProjectCaption varchar) create or replace procedure hs_office.createHsHostingAssetTestData(givenProjectCaption varchar)
language plpgsql as $$ language plpgsql as $$
declare declare
relatedProject hs_booking.project; relatedProject hs_booking.project;
@ -112,9 +112,9 @@ do language plpgsql $$
begin begin
call base.defineContext('creating hosting-asset test-data', null, 'superuser-alex@hostsharing.net', 'rbac.global#global:ADMIN'); call base.defineContext('creating hosting-asset test-data', null, 'superuser-alex@hostsharing.net', 'rbac.global#global:ADMIN');
call createHsHostingAssetTestData('D-1000111 default project'); call hs_office.createHsHostingAssetTestData('D-1000111 default project');
call createHsHostingAssetTestData('D-1000212 default project'); call hs_office.createHsHostingAssetTestData('D-1000212 default project');
call createHsHostingAssetTestData('D-1000313 default project'); call hs_office.createHsHostingAssetTestData('D-1000313 default project');
end; end;
$$; $$;
--// --//