Illegal cross-module *_mod_finance_storage.fund access on migration

Description

Overview:
data-migration/11.0.0/po_line_sync_fund_code.ftl contains this sub-select:

mod-orders-storage violates the module separation by directly accessing ..._mod_finance_storage schema.

The FOLIO architecture mandates that cross-module communication goes through HTTP APIs only.

Some deployments (for example GBV multi-tenant installation) use database ROLEs with access restricted to the current schema. They fail when running this migration script.

If one module requires that some other module exists it must list that other module's interface in its ModuleDescriptor "requires" section.
mod-orders' Module Descriptor has a "requires" section that lists

and

https://github.com/folio-org/mod-orders/blob/v11.2.0/descriptors/ModuleDescriptor-template.json#L731-L767

This makes mod-orders a suitable place to run the migration using API calls.

mod-orders-storage doesn't have a "requires" section in its ModuleDescriptor - this is correct to comply with the FOLIO architecture where each storage module stands on its own.

Steps to Reproduce:

Expected Results:
The last curl upgrade POST succeeds.

Actual Results:
The last curl upgrade POST fails with a 400 error. This is the error log entry in the first console:

', coalesce((SELECT jsonb -> 'code' FROM diku_mod_finance_storage.fund WHERE jsonb ->> 'id' = distrib ->> 'fundId'), distrib -> 'code', '""')))) FROM jsonb_array_elements(jsonb -> 'fundDistribution') distrib ) WHERE jsonb_array_length(jsonb -> 'fundDistribution') > 0
PostgresClient ERROR: relation "diku_mod_finance_storage.fund" does not exist
Position: 188

Environment

None

Potential Workaround

None

Attachments

2

Checklist

hide

TestRail: Results

Activity

Show:

Victoria_Smelova April 23, 2021 at 3:49 PM

Closing as per Julian's comment

Julian Ladisch April 23, 2021 at 2:39 PM

This is migration, this cannot (easily) been tested on BugFest.

I looked into the code and the issue has been solved.

Victoria_Smelova April 23, 2021 at 2:09 PM

 is there a way to get it verified on BugFest to get it closed?

cc

Yauheni Kuzmianok April 14, 2021 at 1:17 PM

Verified on snapshot via migration script 

Raman Auramau March 16, 2021 at 2:30 PM

Done

Details

Assignee

Reporter

Priority

Story Points

Sprint

Development Team

Thunderjet

Fix versions

Release

R1 2021 Bug Fix

Affects versions

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs

Created January 7, 2021 at 11:36 PM
Updated June 16, 2021 at 5:31 PM
Resolved April 15, 2021 at 11:36 AM
TestRail: Cases
TestRail: Runs