Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
194b2b8
refactor: minor simplification
Computerdores Jul 5, 2026
02a9295
refactor: split open_library into new and not new case
Computerdores Jul 5, 2026
bdc8e4b
refactor: remove dead code
Computerdores Jul 5, 2026
6266ba7
doc: add todos and remove trivially true assert
Computerdores Jul 6, 2026
db52089
refactor: add assurance 1 version check
Computerdores Jul 6, 2026
fda10ec
refactor: remove various unnecessary try-except statements in new_lib
Computerdores Jul 6, 2026
a7985b9
refactor: remove unnecessary check in new_lib
Computerdores Jul 6, 2026
804bb89
refactor: move folder assurance after migrations
Computerdores Jul 6, 2026
4a8d404
refactor: massively simplify open_library
Computerdores Jul 6, 2026
67fe77a
refactor: move engine creation to static method
Computerdores Jul 6, 2026
6679bb9
refactor: add version check for assurance 3
Computerdores Jul 6, 2026
f4f33b0
refactor: add assurance 3 to DB 200 migration
Computerdores Jul 6, 2026
eb41ed0
refactor: move assurance 1 to a proper migration method
Computerdores Jul 6, 2026
e383cab
refactor: update version after every successfull migration
Computerdores Jul 6, 2026
cc78c1a
refactor: rewrite migration procedure as loop
Computerdores Jul 6, 2026
d8b339a
refactor: apply migration and update version in same transaction
Computerdores Jul 6, 2026
577cf00
refactor: replace all commits in the migrations with flushes
Computerdores Jul 6, 2026
20dc502
refactor: make sure the migration log statements are consistent
Computerdores Jul 6, 2026
c374843
fix: pass library dir to migrations
Computerdores Jul 6, 2026
660cc40
fix(db migration 8): only add colors that are actually new
Computerdores Jul 6, 2026
6e64dc4
fix: json migration used outdated interface
Computerdores Jul 6, 2026
e5941b4
fix(open_library): create TS directory only if not opened in memory
Computerdores Jul 6, 2026
48612a5
fix: enable sane transaction behaviour
Computerdores Jul 6, 2026
87822f6
refactor: hide 'argument is not accessed' notices
Computerdores Jul 6, 2026
33bc77c
fix(db migration 9): filename property wasn't written correctly
Computerdores Jul 6, 2026
81734c1
fix(db migration 104): include/exclude list was loaded incorrectly
Computerdores Jul 6, 2026
8369738
feat: log start and end of DB migrations
Computerdores Jul 6, 2026
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
16 changes: 10 additions & 6 deletions src/tagstudio/core/library/alchemy/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,17 @@ def make_engine(connection_string: str) -> Engine:

def make_tables(engine: Engine) -> None:
logger.info("[Library] Creating DB tables...")
Base.metadata.create_all(engine)

# tag IDs < 1000 are reserved
# create tag and delete it to bump the autoincrement sequence
# TODO - find a better way
# is this the better way?
with engine.connect() as conn:
# TODO: this should instead be migrations that create the exact tables that were added in
# the respective DB versions
Base.metadata.create_all(conn)
conn.commit()

# TODO: this needs to be a migration
# tag IDs < 1000 are reserved
# create tag and delete it to bump the autoincrement sequence
# TODO - find a better way
# is this the better way?
result = conn.execute(text("SELECT SEQ FROM sqlite_sequence WHERE name='tags'"))
autoincrement_val = result.scalar()
if not autoincrement_val or autoincrement_val <= RESERVED_TAG_END:
Expand Down
Loading
Loading