Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions invenio_app_rdm/upgrade_scripts/migrate_13_0_to_14_0.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# SPDX-FileCopyrightText: 2025 CERN.
# SPDX-FileCopyrightText: 2026 Graz University of Technology.
# SPDX-License-Identifier: MIT
Expand All @@ -19,6 +19,7 @@
5. Update requests to make it ready for the commenting feature
"""

import argparse
import time
from datetime import datetime, timezone

Expand Down Expand Up @@ -388,7 +389,7 @@
secho(f"⚠ Warning: {final_pending} documents still pending", fg="yellow")


def execute_upgrade():
def execute_upgrade(migrate_theses=False):
"""Execute the upgrade from InvenioRDM 13.0 to 14.0.

Please read the disclaimer on this module before thinking about executing
Expand All @@ -402,13 +403,27 @@
records/drafts explicitly. this should improve speed and should make it
easier to upgrade large instances

Args:
migrate_theses (bool): If True, run the migration for publication-thesis resource types.
Defaults to False.
"""
secho("Starting data migration...", fg="green")

run_update_for_resource_type()
if migrate_theses:
run_update_for_resource_type()
run_update_for_request()


# if the script is executed on its own, perform the upgrade
if __name__ == "__main__":
execute_upgrade()
parser = argparse.ArgumentParser(
description="Execute the upgrade from InvenioRDM 13.0 to 14.0"
)
parser.add_argument(
"--migrate-theses",
action="store_true",
default=False,
help="Run the migration for publication-thesis resource types."
)
args = parser.parse_args()
execute_upgrade(migrate_theses=args.migrate_theses)
2 changes: 1 addition & 1 deletion tests/test_migrate_13_0_to_14_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def test_migration(
RDMRecord.index.refresh()

# Run the complete migration
execute_upgrade()
execute_upgrade(migrate_theses=True)

# Refresh indices before searching and testing
RDMDraft.index.refresh()
Expand Down
Loading