Skip to content

Commit

Permalink
wip: codebase upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
zzacharo committed Apr 26, 2024
1 parent 2a47d9c commit c57faa4
Show file tree
Hide file tree
Showing 183 changed files with 9,342 additions and 5,422 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,7 @@ package-lock.json
node_modules

# celery beat
celerybeat*
celerybeat*

# ignore local tmp
tmp
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.9.14
88 changes: 88 additions & 0 deletions Upgrade.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Notes

- index: not_analyzed
- type: completion for suggestions
-[x] ffmpeg: gif method was removed
- admin panel shows Banners
- test statistics, should we install raven?
- missing os-v2 invenio_opendefinition.mappings
- existing kw need updating, remove payload as it is not supported

# DB update

- if local users then we need to re-encrypt the passwords
- set SECURITY_PASSWORD_SINGLE_HASH = True
- invenio alembic upgrade
- Remove keywords.suggest_name.payload
```
from sqlalchemy.orm.exc import NoResultFound

from cds.modules.records.api import Keyword
from invenio_pidstore.models import PersistentIdentifier, PIDStatus
from invenio_db import db


def get_all_pids_by(pid_type):
"""Get all PIDs for the given type.

:param pid_type: String representing the PID type value, for example 'recid'.
"""
pids = PersistentIdentifier.query.filter(PersistentIdentifier.pid_type == pid_type).filter(
PersistentIdentifier.status == PIDStatus.REGISTERED).yield_per(100)
return pids


def get_record_by_pid(pid):
"""Fetch and return the published record given its PID.

:param pid: String representing the PID value.
"""
try:
return Keyword.get_record(pid.object_uuid)
except NoResultFound:
return None


kwds = get_all_pids_by("kwid")

for pid in kwds:
rec = get_record_by_pid(pid)
if rec is not None:
rec["suggest_name"].pop("payload", None)
rec.commit()
db.session.commit()
```

# Search reindex

```bash

cds index reindex -t recid
cds index reindex -t depid
cds index reindex -t catid
cds index reindex -t kwid
cds index run

```

## Local setup

- Node v18
- Python 3.9

```bash

# setup
./scripts/bootstrap_upgrade
./scripts/setup-instance.sh

# web server
./scripts/server

# celery
./scripts/celery

# assets watch
./scripts/assets-watch

```
Loading

0 comments on commit c57faa4

Please sign in to comment.