From 39930403408244083219d571bb7eb31715e325fe Mon Sep 17 00:00:00 2001 From: Matteo Campinoti Date: Tue, 29 Oct 2024 07:31:14 +0100 Subject: [PATCH] database.upgrade:upgrade_3_2to3_3 - set `original_name` for files without history entries --- acacore/database/upgrade.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/acacore/database/upgrade.py b/acacore/database/upgrade.py index e8c5bc8..c9cedeb 100644 --- a/acacore/database/upgrade.py +++ b/acacore/database/upgrade.py @@ -273,6 +273,14 @@ def _find_original_name(uuid: str, relative_path: str) -> str: ), ) + conn.executemany( + "update Files set original_name = ? where uuid = ?", + ( + (Path(relative_path).name, uuid) + for uuid, relative_path in conn.execute("select uuid, relative_path from Files where original_name = ''") + ), + ) + return set_db_version(conn, Version("3.3.0"))