Skip to end of banner
Go to start of banner

Copy of Script for Identifying Item Records that Have Invalid itemLevelCallNumberTypeId Types

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Before MODINVSTOR-987 was released, It was possible to set itemLevelCallNumberTypeId values for items that are invalid UUIDs or do not refer to a known call number type.

This script helps identify the records that would become invalid when this change is made so the records can be fixed prior to rolling out the change.  the records would need to be manually updated either through the UI or via calls to the relevant API.

SET search_path TO {tenant}_mod_inventory_storage;
SELECT item.id AS "item id", item.jsonb ->> 'itemLevelCallNumberTypeId' AS "Call Number Type ID"
FROM item
LEFT JOIN call_number_type ON
  CASE WHEN item.jsonb->>'itemLevelCallNumberTypeId' ~* '^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$'
       THEN (item.jsonb->>'itemLevelCallNumberTypeId')::uuid = call_number_type.id
       ELSE false
  END
WHERE call_number_type.id is null;

Where {tenant} - the owner (tenant) for which you want to run the report.


  • No labels