Skip to content

Commit

Permalink
fix: don't check db version with new library (TagStudioDev#536)
Browse files Browse the repository at this point in the history
  • Loading branch information
yedpodtrzitko authored Oct 8, 2024
1 parent 7dd0f3d commit 7574ad3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tagstudio/src/core/library/alchemy/library.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import re
import shutil
import sys
import unicodedata
from dataclasses import dataclass
from datetime import UTC, datetime
Expand Down Expand Up @@ -143,9 +142,11 @@ def close(self):
def open_library(self, library_dir: Path, storage_path: str | None = None) -> LibraryStatus:
if storage_path == ":memory:":
self.storage_path = storage_path
is_new = True
else:
self.verify_ts_folders(library_dir)
self.storage_path = library_dir / TS_FOLDER_NAME / self.FILENAME
is_new = not self.storage_path.exists()

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

if "pytest" not in sys.modules:
# dont check db version when creating new library
if not is_new:
db_version = session.scalar(
select(Preferences).where(Preferences.key == LibraryPrefs.DB_VERSION.name)
)

if not db_version:
# TODO - remove after #503 is merged and LibraryPrefs.DB_VERSION increased again
return LibraryStatus(
success=False,
message=(
Expand Down

0 comments on commit 7574ad3

Please sign in to comment.