Skip to content

Commit 7bda5e6

Browse files
committed
Fix issue with undo db migration
1 parent db2e30c commit 7bda5e6

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
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)
354+
migrate_undodb(db_handle.undodb, tree_id=dbmgr.dirname)
355355
finally:
356356
close_db(db_handle)
357357

gramps_webapi/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121

2222
"""Version information."""
2323

24-
__version__ = "3.0.0"
24+
__version__ = "3.0.1"

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)
411+
migrate_undodb(db_handle.undodb, tree)
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)
423+
migrate_undodb(db_handle.undodb, tree)
424424
finally:
425425
close_db(db_handle)
426426

gramps_webapi/data/apispec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
swagger: "2.0"
22
info:
33
title: "Gramps Web API"
4-
version: "3.0.0"
4+
version: "3.0.1"
55
description: >
66
The Gramps Web API is a REST API that provides access to family tree databases generated and maintained with Gramps, a popular Open Source genealogical research software package.
77

gramps_webapi/undodb.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,12 +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) -> None:
605+
def migrate(undodb: DbUndoSQL, tree_id: str) -> 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)
611+
.join(Connection)
612+
.filter(Connection.tree_id == tree_id)
611613
.filter(Change.old_json.is_(None), Change.new_json.is_(None))
612614
.all()
613615
)

0 commit comments

Comments
 (0)