Skip to content

Commit 33bc77c

Browse files
committed
fix(db migration 9): filename property wasn't written correctly
1 parent 87822f6 commit 33bc77c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,8 @@ def open_sqlite_library(
598598
logger.info(f"[Library] Library migrated to DB version {DB_VERSION}")
599599

600600
# check if folder matching current path exists already
601+
# NOTE: this has been causing new Folders to be created when the library is moved, since
602+
# its introduction
601603
self.folder = session.scalar(select(Folder).where(Folder.path == library_dir))
602604
if not self.folder:
603605
folder = Folder(
@@ -686,7 +688,8 @@ def __apply_db9_migration(self, session: Session, __library_dir__: Path):
686688

687689
# Populate the new filename column.
688690
for entry in self.__all_entries(session):
689-
session.merge(entry).filename = entry.path.name
691+
entry.filename = entry.path.name
692+
session.merge(entry)
690693
session.flush()
691694
logger.info("[Library][Migration][9] Populated filename column in entries table")
692695

0 commit comments

Comments
 (0)