Script to identify invalid associations between Match profile linked to Modify Action profile
https://folio-org.atlassian.net/browse/MODDICONV-375
SQL for receiving unique JobProfile Ids where Match Profile inside this Job Profile has an association with the Modify Action Profile and this association has order = 0 and current job profile was NOT deleted:
SELECT DISTINCT
m.jsonb->>'jobProfileId' AS jobProfileId
FROM
{tenantId}_mod_di_converter_storage.match_to_action_profiles m
JOIN
{tenantId}_mod_di_converter_storage.action_profiles a ON m.jsonb->>'detailProfileId' = a.jsonb->>'id'
JOIN
{tenantId}_mod_di_converter_storage.job_profiles j ON m.jsonb->>'jobProfileId' = j.jsonb->>'id'
WHERE
a.jsonb->>'action' = 'MODIFY'
AND m.jsonb->>'order' = '0'
AND j.jsonb->>'deleted' = 'false';