diff --git a/ramls/acq-models b/ramls/acq-models index 1652e69e..c06778a4 160000 --- a/ramls/acq-models +++ b/ramls/acq-models @@ -1 +1 @@ -Subproject commit 1652e69e9e98499b805b698e59efd7d2a51d98b5 +Subproject commit c06778a484802db30023f1e5388a6d2972606ae1 diff --git a/src/main/resources/templates/db_scripts/migration/extract_credits_from_expenditures.sql b/src/main/resources/templates/db_scripts/migration/extract_credits_from_expenditures.sql index 5a5cf588..4b18f8f0 100644 --- a/src/main/resources/templates/db_scripts/migration/extract_credits_from_expenditures.sql +++ b/src/main/resources/templates/db_scripts/migration/extract_credits_from_expenditures.sql @@ -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;