Skip to content

Commit 190c2e3

Browse files
committed
Fix another issue with SharedPostgreSQL undo migration
1 parent 7bda5e6 commit 190c2e3

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

gramps_webapi/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def migrate_gramps_undodb(ctx):
351351
dbmgr = ctx.obj["db_manager"]
352352
db_handle = dbmgr.get_db().db
353353
try:
354-
migrate_undodb(db_handle.undodb, tree_id=dbmgr.dirname)
354+
migrate_undodb(db_handle.undodb)
355355
finally:
356356
close_db(db_handle)
357357

gramps_webapi/api/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def upgrade_database_schema(self, tree: str, user_id: str):
408408
tree=tree, view_private=True, readonly=False, user_id=user_id
409409
)
410410
try:
411-
migrate_undodb(db_handle.undodb, tree)
411+
migrate_undodb(db_handle.undodb)
412412
finally:
413413
close_db(db_handle)
414414

@@ -420,7 +420,7 @@ def upgrade_undodb_schema(self, tree: str, user_id: str):
420420
tree=tree, view_private=True, readonly=False, user_id=user_id
421421
)
422422
try:
423-
migrate_undodb(db_handle.undodb, tree)
423+
migrate_undodb(db_handle.undodb)
424424
finally:
425425
close_db(db_handle)
426426

gramps_webapi/undodb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,14 +602,14 @@ def get_transaction(
602602
return transaction._to_dict(old_data=old_data, new_data=new_data)
603603

604604

605-
def migrate(undodb: DbUndoSQL, tree_id: str) -> None:
605+
def migrate(undodb: DbUndoSQL) -> None:
606606
"""Migrate the undo db to a new schema if needed."""
607607
with undodb.session_scope() as session:
608608
# return all rows where old_json AND new_json are NULL
609609
rows = (
610610
session.query(Change)
611611
.join(Connection)
612-
.filter(Connection.tree_id == tree_id)
612+
.filter(Connection.tree_id == undodb.tree_id)
613613
.filter(Change.old_json.is_(None), Change.new_json.is_(None))
614614
.all()
615615
)

0 commit comments

Comments
 (0)