From 61ab23472b27461142c187b3bf3000e06c5557e1 Mon Sep 17 00:00:00 2001 From: g0ldyy <153996346+g0ldyy@users.noreply.github.com> Date: Wed, 10 Dec 2025 18:20:26 +0100 Subject: [PATCH] refactor: move db_maintenance table creation to the correct migration step - Reintroduced the creation of the db_maintenance table in the appropriate section of the database setup process. - Ensured that the table is created after the version migration to maintain database integrity. --- comet/core/database.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/comet/core/database.py b/comet/core/database.py index 410b1ef..f4abb5e 100644 --- a/comet/core/database.py +++ b/comet/core/database.py @@ -30,14 +30,6 @@ async def setup_database(): """ ) - await database.execute( - """ - CREATE TABLE IF NOT EXISTS db_maintenance ( - id INTEGER PRIMARY KEY CHECK (id = 1), - last_startup_cleanup REAL - ) - """ - ) current_version = await database.fetch_val( """ @@ -86,6 +78,15 @@ async def setup_database(): "COMET", f"Database: Migration to version {DATABASE_VERSION} completed" ) + await database.execute( + """ + CREATE TABLE IF NOT EXISTS db_maintenance ( + id INTEGER PRIMARY KEY CHECK (id = 1), + last_startup_cleanup REAL + ) + """ + ) + await database.execute( """ CREATE TABLE IF NOT EXISTS ongoing_searches (