From 24f9f27e6370dfb077223859e1788237f202d07a Mon Sep 17 00:00:00 2001 From: Jann Stute Date: Thu, 23 Jul 2026 19:37:12 +0200 Subject: [PATCH] refactor: remove unnecessary assurance Bumping the auto increment value has been done since the original sql PR, so it doesn't need to be done on migrations. See e5e7b8afc62c1a958c172b35819caa26995f2060. --- src/tagstudio/core/library/alchemy/library.py | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/src/tagstudio/core/library/alchemy/library.py b/src/tagstudio/core/library/alchemy/library.py index c3f8dc61..a4667133 100644 --- a/src/tagstudio/core/library/alchemy/library.py +++ b/src/tagstudio/core/library/alchemy/library.py @@ -578,29 +578,6 @@ class Library: ModelBase.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? - with self.engine.connect() as conn: - 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: - try: - conn.execute( - text( - "INSERT INTO tags " - "(id, name, color_namespace, color_slug, is_category, is_hidden) " - f"VALUES ({RESERVED_TAG_END}, 'temp', NULL, NULL, false, false)" - ) - ) - conn.execute(text(f"DELETE FROM tags WHERE id = {RESERVED_TAG_END}")) - conn.commit() - except OperationalError as e: - logger.error("Could not initialize built-in tags", error=e) - conn.rollback() - # migrate DB step by step from one version to the next # (migration_method, db_version, initial_db_version) migrations = [