Skip to content

Commit 81734c1

Browse files
committed
fix(db migration 104): include/exclude list was loaded incorrectly
1 parent 33bc77c commit 81734c1

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/tagstudio/core/library/alchemy/library.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import sqlalchemy
2424
import structlog
25+
import ujson
2526
from humanfriendly import format_timespan # pyright: ignore[reportUnknownVariableType]
2627
from sqlalchemy import (
2728
URL,
@@ -712,6 +713,7 @@ def __apply_db101_migration(self, session: Session, __library_dir__: Path):
712713

713714
def __apply_db102_migration(self, session: Session, __library_dir__: Path):
714715
"""Migrate DB to DB_VERSION 102."""
716+
# delete TagParents with a dangling parent reference
715717
stmt = delete(TagParent).where(TagParent.parent_id.not_in(select(Tag.id).distinct()))
716718
session.execute(stmt)
717719
session.flush()
@@ -743,8 +745,10 @@ def __migrate_sql_to_ts_ignore(self, session: Session, library_dir: Path):
743745
return
744746

745747
# Load legacy extension data
746-
extensions: list[str] = unwrap(
747-
session.scalar(text("SELECT value FROM preferences WHERE key = 'EXTENSION_LIST'"))
748+
extensions: list[str] = ujson.loads(
749+
unwrap(
750+
session.scalar(text("SELECT value FROM preferences WHERE key = 'EXTENSION_LIST'"))
751+
)
748752
)
749753
is_exclude_list: bool = unwrap(
750754
session.scalar(text("SELECT value FROM preferences WHERE key = 'IS_EXCLUDE_LIST'"))

0 commit comments

Comments
 (0)