avalonmediasystem / avalon

Avalon Media System – Samvera Application
http://www.avalonmediasystem.org/
Apache License 2.0
93 stars 51 forks source link

Add migration to backfill parent_id onto existing supplemental files #5855

Open masaball opened 1 month ago

masaball commented 1 month ago

Description

In the work done for transcript search, we added a new field to SupplementalFile to point to the parent object (parent_id). We will need some way to backfill this field on existing files.

@cjcolvar's suggestion:

I was thinking a rake task in avalon_migrations.rake that would more or less be:

  1. Find all objects with supplemental files in solr
  2. For each object's supplemental_file_json_ssim go through ids and load supplemental file, add parent_id and save unless parent_id.present?

Since update_index is run in a callback after updates, this backfill will likely also take care of getting existing transcripts indexed but we will need to test to make sure it works as expected.

Done Looks Like

elynema commented 1 week ago

@masaball Has this been run on avalon-dev yet, or will it work to test there? I'm thinking we should run this in an environment where we have identified an old transcript that is not yet indexed so we can verify the part about also getting existing transcripts indexed.

masaball commented 1 week ago

parent_id backfill has already been run on Avalon-dev, looking back through slack.

elynema commented 1 week ago

Ok, so let's leave this in QA until we have a PR on avalon-staging and then we can test there?

masaball commented 1 week ago

That sounds good :+1: