Skip to content

Commit

Permalink
[MODFISTO-511] - Update script to avoid duplication issue (#437)
Browse files Browse the repository at this point in the history
* Update script

* Fix script

* Update script

* Update script
  • Loading branch information
azizbekxm authored Nov 22, 2024
1 parent c4dab7f commit 133b918
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ WITH aggregated_amounts AS (
)
UPDATE ${myuniversity}_${mymodule}.transaction AS encumbrance
SET
jsonb = jsonb || jsonb_build_object(
'encumbrance', jsonb_build_object(
'amountExpended', to_jsonb(aggregated_amounts.total_expended),
'amountCredited', to_jsonb(aggregated_amounts.total_credited)
)
jsonb = jsonb_set(
jsonb_set(
encumbrance.jsonb,
'{encumbrance,amountExpended}',
to_jsonb(aggregated_amounts.total_expended)
),
'{encumbrance,amountCredited}',
to_jsonb(aggregated_amounts.total_credited)
)
FROM aggregated_amounts
WHERE encumbrance.id = aggregated_amounts.encumbrance_id;

0 comments on commit 133b918

Please sign in to comment.