Skip to content

fix: dont check db version with new library #536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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