Skip to content

Commit

Permalink
migration: account for deleted communities and draft concept DOI
Browse files Browse the repository at this point in the history
  • Loading branch information
fenekku committed Aug 30, 2024
1 parent 8205056 commit 8e0903d
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions invenio_app_rdm/upgrade_scripts/migrate_11_0_to_12_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ def execute_upgrade():
"""

def migrate_review_policy(community_record):
review_policy = community_record["access"].get(
if community_record.is_deleted:
return

community_record["access"].setdefault(
"review_policy", ReviewPolicyEnum.CLOSED.value
)
community_record["access"]["review_policy"] = review_policy

def update_parent(record):
"""Update parent schema and parent communities for older records."""
Expand Down Expand Up @@ -94,12 +96,13 @@ def update_parent(record):
record.parent, pids
)
record.parent["pids"] = pids
current_rdm_records.records_service.pids.register_or_update(
id_=record["id"],
identity=system_identity,
scheme="doi",
parent=True,
)
if isinstance(record, RDMRecord):
current_rdm_records.records_service.pids.register_or_update(
id_=record["id"],
identity=system_identity,
scheme="doi",
parent=True,
)

def update_record(record):
# skipping deleted records because can't be committed
Expand Down

0 comments on commit 8e0903d

Please sign in to comment.