add advanced scenario-tests for coop-assets #123
@ -24,7 +24,7 @@ create table if not exists hs_office.coopassettx
|
|||||||
valueDate date not null,
|
valueDate date not null,
|
||||||
assetValue numeric(12,2) not null, -- https://wiki.postgresql.org/wiki/Don't_Do_This#Don.27t_use_money
|
assetValue numeric(12,2) not null, -- https://wiki.postgresql.org/wiki/Don't_Do_This#Don.27t_use_money
|
||||||
reference varchar(48) not null,
|
reference varchar(48) not null,
|
||||||
revertedAssetTxuUid uuid unique REFERENCES hs_office.coopassettx(uuid) DEFERRABLE INITIALLY DEFERRED,
|
revertedAssetTxUuid uuid unique REFERENCES hs_office.coopassettx(uuid) DEFERRABLE INITIALLY DEFERRED,
|
||||||
assetAdoptionTxUuid uuid unique REFERENCES hs_office.coopassettx(uuid) DEFERRABLE INITIALLY DEFERRED,
|
assetAdoptionTxUuid uuid unique REFERENCES hs_office.coopassettx(uuid) DEFERRABLE INITIALLY DEFERRED,
|
||||||
comment varchar(512)
|
comment varchar(512)
|
||||||
);
|
);
|
||||||
@ -37,11 +37,11 @@ create table if not exists hs_office.coopassettx
|
|||||||
|
|
||||||
alter table hs_office.coopassettx
|
alter table hs_office.coopassettx
|
||||||
add constraint reversal_asset_tx_must_have_reverted_asset_tx
|
add constraint reversal_asset_tx_must_have_reverted_asset_tx
|
||||||
check (transactionType <> 'REVERSAL' or revertedAssetTxuUid is not null);
|
check (transactionType <> 'REVERSAL' or revertedAssetTxUuid is not null);
|
||||||
|
|
||||||
alter table hs_office.coopassettx
|
alter table hs_office.coopassettx
|
||||||
add constraint non_reversal_asset_tx_must_not_have_reverted_asset_tx
|
add constraint non_reversal_asset_tx_must_not_have_reverted_asset_tx
|
||||||
check (transactionType = 'REVERSAL' or revertedAssetTxuUid is null or transactionType = 'REVERSAL');
|
check (transactionType = 'REVERSAL' or revertedAssetTxUuid is null or transactionType = 'REVERSAL');
|
||||||
|
|
||||||
alter table hs_office.coopassettx
|
alter table hs_office.coopassettx
|
||||||
add constraint transfer_asset_tx_must_have_adopted_asset_tx
|
add constraint transfer_asset_tx_must_have_adopted_asset_tx
|
||||||
|
@ -31,7 +31,7 @@ begin
|
|||||||
transferTx := uuid_generate_v4();
|
transferTx := uuid_generate_v4();
|
||||||
adoptionTx := uuid_generate_v4();
|
adoptionTx := uuid_generate_v4();
|
||||||
insert
|
insert
|
||||||
into hs_office.coopassettx(uuid, membershipuuid, transactiontype, valuedate, assetvalue, reference, comment, revertedAssetTxuUid, assetAdoptionTxUuid)
|
into hs_office.coopassettx(uuid, membershipuuid, transactiontype, valuedate, assetvalue, reference, comment, revertedAssetTxUuid, assetAdoptionTxUuid)
|
||||||
values
|
values
|
||||||
(uuid_generate_v4(), membership.uuid, 'DEPOSIT', '2010-03-15', 320.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-1', 'initial deposit', null, null),
|
(uuid_generate_v4(), membership.uuid, 'DEPOSIT', '2010-03-15', 320.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-1', 'initial deposit', null, null),
|
||||||
(uuid_generate_v4(), membership.uuid, 'DISBURSAL', '2021-09-01', -128.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-2', 'partial disbursal', null, null),
|
(uuid_generate_v4(), membership.uuid, 'DISBURSAL', '2021-09-01', -128.00, 'ref '||givenPartnerNumber || givenMemberNumberSuffix||'-2', 'partial disbursal', null, null),
|
||||||
|
Loading…
Reference in New Issue
Block a user