From 43e0549d53c4fa46bce3bab250dcae8e6a9db3ec Mon Sep 17 00:00:00 2001 From: James Tessmer Date: Wed, 9 Oct 2024 12:36:00 -0700 Subject: [PATCH] Add instance check for metadata_submission --- .../988105f6581d_update_datasetDoi_to_awardDoi.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nmdc_server/migrations/versions/988105f6581d_update_datasetDoi_to_awardDoi.py b/nmdc_server/migrations/versions/988105f6581d_update_datasetDoi_to_awardDoi.py index ef8cb1e5..80c9ad2d 100644 --- a/nmdc_server/migrations/versions/988105f6581d_update_datasetDoi_to_awardDoi.py +++ b/nmdc_server/migrations/versions/988105f6581d_update_datasetDoi_to_awardDoi.py @@ -39,8 +39,13 @@ def upgrade(): mappings = [] for submission_metadata in session.query(SubmissionMetadata): metadata_submission = submission_metadata.metadata_submission + + if isinstance(metadata_submission, list): + continue + context_form = metadata_submission["contextForm"] + if not context_form.get("awardDoi", None) and context_form.get("datasetDoi", None): holder = context_form["datasetDoi"] holder = holder.split(",") @@ -57,6 +62,10 @@ def downgrade(): mappings = [] for submission_metadata in session.query(SubmissionMetadata): metadata_submission = submission_metadata.metadata_submission + + if isinstance(metadata_submission, list): + continue + context_form = metadata_submission["contextForm"] if not context_form.get("datasetDoi", None) and context_form.get("awardDoi", None):