diff --git a/src/tagstudio/core/library/alchemy/library.py b/src/tagstudio/core/library/alchemy/library.py index a4f1d205..068a0980 100644 --- a/src/tagstudio/core/library/alchemy/library.py +++ b/src/tagstudio/core/library/alchemy/library.py @@ -598,6 +598,8 @@ class Library: logger.info(f"[Library] Library migrated to DB version {DB_VERSION}") # check if folder matching current path exists already + # NOTE: this has been causing new Folders to be created when the library is moved, since + # its introduction self.folder = session.scalar(select(Folder).where(Folder.path == library_dir)) if not self.folder: folder = Folder( @@ -686,7 +688,8 @@ class Library: # Populate the new filename column. for entry in self.__all_entries(session): - session.merge(entry).filename = entry.path.name + entry.filename = entry.path.name + session.merge(entry) session.flush() logger.info("[Library][Migration][9] Populated filename column in entries table")