MODINVSTOR-940: Populate effective values field for existing holdings records

If a library went live with folio before Juniper release, the script that populates values for the effectiveLocationId field may not have run properly.  If that's the case,

you can run the script below to ensure that all holdings records have a proper value in that field.

If that involves a large number of holdings records, you may wish to run this script at a time when usage of the system is minimal.


Update all holdings records with an appropriate effectiveLocation


SET jsonb = JSONB_SET(holdings_record.jsonb, '{effectiveLocationId}',
TO_JSONB(COALESCE(temporarylocationid, permanentlocationid)))
WHERE effectivelocationid IS null;