diff --git a/src/main/resources/db/changelog/5-hs-office/512-coopassets/5120-hs-office-coopassets.sql b/src/main/resources/db/changelog/5-hs-office/512-coopassets/5120-hs-office-coopassets.sql index 02b8e401..9604f5e9 100644 --- a/src/main/resources/db/changelog/5-hs-office/512-coopassets/5120-hs-office-coopassets.sql +++ b/src/main/resources/db/changelog/5-hs-office/512-coopassets/5120-hs-office-coopassets.sql @@ -22,7 +22,7 @@ create table if not exists hs_office.coopassettx membershipUuid uuid not null references hs_office.membership(uuid), transactionType hs_office.CoopAssetsTransactionType not null, valueDate date not null, - assetValue money not null, + assetValue numeric(12,2) not null, -- TODO.impl: use money type, but we had problems with Hibernate conversion reference varchar(48) not null, revertedAssetTxUuid uuid unique REFERENCES hs_office.coopassettx(uuid) DEFERRABLE INITIALLY DEFERRED, comment varchar(512) @@ -44,12 +44,12 @@ alter table hs_office.coopassettx --changeset michael.hoennig:hs-office-coopassets-ASSET-VALUE-CONSTRAINT endDelimiter:--// -- ---------------------------------------------------------------------------- -create or replace function hs_office.coopassetstx_check_positive_total(forMembershipUuid UUID, newAssetValue money) +create or replace function hs_office.coopassetstx_check_positive_total(forMembershipUuid UUID, newAssetValue numeric(12, 5)) returns boolean language plpgsql as $$ declare - currentAssetValue money; - totalAssetValue money; + currentAssetValue numeric(12,2); + totalAssetValue numeric(12,2); begin select sum(cat.assetValue) from hs_office.coopassettx cat diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionRepositoryIntegrationTest.java index 5d9316e2..523bea88 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/coopassets/HsOfficeCoopAssetsTransactionRepositoryIntegrationTest.java @@ -69,7 +69,7 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase final var newCoopAssetsTransaction = HsOfficeCoopAssetsTransactionEntity.builder() .membership(givenMembership) .transactionType(HsOfficeCoopAssetsTransactionType.DEPOSIT) - .assetValue(new BigDecimal("128.00")) + .assetValue(new BigDecimal("6,400.00")) .valueDate(LocalDate.parse("2022-10-18")) .reference("temp ref A") .build(); @@ -98,7 +98,7 @@ class HsOfficeCoopAssetsTransactionRepositoryIntegrationTest extends ContextBase final var newCoopAssetsTransaction = HsOfficeCoopAssetsTransactionEntity.builder() .membership(givenMembership) .transactionType(HsOfficeCoopAssetsTransactionType.DEPOSIT) - .assetValue(new BigDecimal("128.00")) + .assetValue(new BigDecimal("6400.00")) .valueDate(LocalDate.parse("2022-10-18")) .reference("temp ref B") .build();