Skip to content

Commit ad638c6

Browse files
committed
fix: dont check db version with new library
1 parent 7dd0f3d commit ad638c6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import re
22
import shutil
3-
import sys
43
import unicodedata
54
from dataclasses import dataclass
65
from datetime import UTC, datetime
@@ -141,11 +140,13 @@ def close(self):
141140
self.folder = None
142141

143142
def open_library(self, library_dir: Path, storage_path: str | None = None) -> LibraryStatus:
143+
is_new = True
144144
if storage_path == ":memory:":
145145
self.storage_path = storage_path
146146
else:
147147
self.verify_ts_folders(library_dir)
148148
self.storage_path = library_dir / TS_FOLDER_NAME / self.FILENAME
149+
is_new = not self.storage_path.exists()
149150

150151
connection_string = URL.create(
151152
drivername="sqlite",
@@ -165,13 +166,13 @@ def open_library(self, library_dir: Path, storage_path: str | None = None) -> Li
165166
# default tags may exist already
166167
session.rollback()
167168

168-
if "pytest" not in sys.modules:
169+
# dont check db version when creating new library
170+
if not is_new:
169171
db_version = session.scalar(
170172
select(Preferences).where(Preferences.key == LibraryPrefs.DB_VERSION.name)
171173
)
172174

173175
if not db_version:
174-
# TODO - remove after #503 is merged and LibraryPrefs.DB_VERSION increased again
175176
return LibraryStatus(
176177
success=False,
177178
message=(

0 commit comments

Comments
 (0)