/
Poppy list migration script

Poppy list migration script

Background

There was a breaking change between P and Q, where certain fields in queries need to be fixed in order to make the lists editable
This script updates lists to account for this change. It is only needed if lists were created in Poppy that use any of these fields:

  • item_level_call_number_typeid

  • item_effective_call_number_typeid

  • item_effective_library_id

  • item_effective_location_id

  • item_material_type_id

  • item_permanent_location_id

  • item_temporary_location_id

  • item_material_type_id

  • loan_checkin_servicepoint_id

  • loan_checkout_servicepoint_id

  • loan_policy_id

  • user_patron_group_id

These fields have corresponding name fields, which are what users actually see. In Quesnelia, FQM (the system used to provide data for Lists) was updated to handle these fields differently, so that queries use the form e.g., loan_policy_name == 7ed9ce32-7cf8-4d14-9223-d2ac17356529 instead of the old loan_policy_id == 7ed9ce32-7cf8-4d14-9223-d2ac17356529 form. The old form still works in the back-end, but the UI now expects the newer form. The Lists app stores queries as part of its list definitions, so old lists with queries that use those fields can no longer be updated through the Lists UI. This migration script addresses the problem my replacing the “ID” field names with the “name” field names.

Should I run the script?

Consider running the migration script if the following are all true:

  • The FOLIO instance was running Poppy at one point and was updated to Quesnelia or later (ideally, the script is run on Quesnelia before upgrading further. If run on Ramsons or later, this will be handled by the built-in list migration, which is triggered automatically upon upgrading the module)

  • When running Poppy, the Lists app was used

  • Lists were created in Poppy that used any of the above ID fields

  • Recreating those lists manually via the UI is too much of a burden for users (e.g., there are a lot of affected lists or the lists use large/complex queries)

 

You can use this query to determine if any lists in a tenant are impacted (make sure to set the tenant ID first!).

-- Replace <tenant ID> with the relevant tenant ID here! SET search_path TO '<tenant ID>_mod_lists', public; SELECT * FROM list_details WHERE fql_query ~* '\m(item_level_call_number_typeid|item_effective_call_number_typeid|item_effective_library_id|item_effective_location_id|item_material_type_id|item_permanent_location_id|item_temporary_location_id|item_material_type_id|loan_checkin_servicepoint_id|loan_checkout_servicepoint_id|loan_policy_id|user_patron_group_id)\M'

This query returns the list of lists that were created in Poppy that are broken in future releases; you should save. If it returns any results, then you should consider running the migration script below. If only a few lists are affected, consider asking the owning users to recreate the lists manually. If you decide to use this script to migrate lists,

Benefits

  • No action is needed by users

  • Fast

  • Simple

  • Uses list versioning for added safety

Risks

  • Requires direct DB access and modifying data directly in the DB, which is always at least a little risky