scoped programmatic i18n-keys (#190)
Co-authored-by: Michael Hoennig <michael@hoennig.de> Reviewed-on: https://dev.hostsharing.net/hostsharing/hs.hsadmin.ng/pulls/190 Reviewed-by: Timotheus Pokorra <timotheus.pokorra@hostsharing.net>
This commit is contained in:
+3
-3
@@ -33,7 +33,7 @@ alter table hs_office.coopsharetx
|
||||
--//
|
||||
|
||||
-- ============================================================================
|
||||
--changeset marc.sandlus:hs-office-coopshares-SHARE-COUNT-CONSTRAINT-BY-TRIGGER endDelimiter:--//
|
||||
--changeset marc.sandlus:hs-office-coopshares-SHARE-COUNT-CONSTRAINT-BY-TRIGGER runOnChange:true validCheckSum:ANY endDelimiter:--//
|
||||
-- ----------------------------------------------------------------------------
|
||||
|
||||
alter table hs_office.coopsharetx drop constraint if exists check_positive_total_shares_count;
|
||||
@@ -42,7 +42,6 @@ drop function if exists hs_office.coopsharestx_check_positive_total cascade;
|
||||
|
||||
create or replace function hs_office.coopsharetx_enforce_positive_total()
|
||||
returns trigger as $$
|
||||
|
||||
declare
|
||||
currentShareCount integer;
|
||||
totalShareCount integer;
|
||||
@@ -53,12 +52,13 @@ begin
|
||||
into currentShareCount;
|
||||
totalShareCount := currentShareCount + NEW.shareCount;
|
||||
if totalShareCount < 0 then
|
||||
raise exception '[400] coop shares transaction would result in a negative number of shares';
|
||||
raise exception '[400] office.coop-shares.transaction-would-result-in-a-negative-number-of-shares';
|
||||
end if;
|
||||
return NEW;
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;;
|
||||
|
||||
drop trigger if exists positive_total_shares_count_tg on hs_office.coopsharetx;
|
||||
|
||||
create trigger positive_total_shares_count_tg before insert
|
||||
on hs_office.coopsharetx
|
||||
|
||||
+4
-3
@@ -73,7 +73,7 @@ CREATE TRIGGER enforce_transaction_constraints
|
||||
--//
|
||||
|
||||
-- ============================================================================
|
||||
--changeset marc.sandlus:hs-office-coopassets-ASSET-VALUE-CONSTRAINT-BY-TRIGGER endDelimiter:--//
|
||||
--changeset marc.sandlus:hs-office-coopassets-ASSET-VALUE-CONSTRAINT-BY-TRIGGER runOnChange:true validCheckSum:ANY endDelimiter:--//
|
||||
-- ----------------------------------------------------------------------------
|
||||
|
||||
alter table hs_office.coopassettx
|
||||
@@ -83,7 +83,6 @@ drop function if exists hs_office.coopassetstx_check_positive_total cascade;
|
||||
|
||||
create or replace function hs_office.coopassettx_enforce_positive_total()
|
||||
returns trigger as $$
|
||||
|
||||
declare
|
||||
currentAssetValue numeric(12,2);
|
||||
totalAssetValue numeric(12,2);
|
||||
@@ -94,12 +93,14 @@ begin
|
||||
into currentAssetValue;
|
||||
totalAssetValue := currentAssetValue + NEW.assetValue;
|
||||
if totalAssetValue::numeric < 0 then
|
||||
raise exception '[400] coop assets transaction would result in a negative balance of assets';
|
||||
raise exception '[400] office.coop-assets.transaction-would-result-in-a-negative-balance-of-assets';
|
||||
end if;
|
||||
return NEW;
|
||||
end;
|
||||
$$ LANGUAGE plpgsql;;
|
||||
|
||||
drop trigger if exists positive_total_assets_count_tg on hs_office.coopassettx;
|
||||
|
||||
create trigger positive_total_assets_count_tg before insert
|
||||
on hs_office.coopassettx
|
||||
for each row execute function hs_office.coopassettx_enforce_positive_total();
|
||||
|
||||
Reference in New Issue
Block a user