Skip to content

Commit

Permalink
Add change version index script
Browse files Browse the repository at this point in the history
  • Loading branch information
tmorrell committed Oct 30, 2024
1 parent deadbdf commit b6c849c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions scripts/change_version_index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Run with `pipenv run invenio shell fix_version.py`

from invenio_db import db
from invenio_accounts import current_accounts
from invenio_utilities_tuw.utils import get_identity_for_user, get_record_service


pids = ['g5k1d-1rp46']

u = get_identity_for_user(2)
service = get_record_service()

for pid in pids:
record = service.record_cls.pid.resolve(pid)
print(record.versions)
record.versions._record.model.index = 4
record.commit()
db.session.commit()
service.indexer.index(record)
print(record.versions)

0 comments on commit b6c849c

Please sign in to comment.