From 6c353dcaf8b7ed8e105fc1239a52781554e3cf2e Mon Sep 17 00:00:00 2001 From: sbcrumb Date: Sat, 18 Oct 2025 09:32:42 -0400 Subject: [PATCH] db: debug --- VERSION | 2 +- core/database.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index bc4abe8..5aa7c52 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.3.8 +2.3.9 diff --git a/core/database.py b/core/database.py index 2b17710..7f8237e 100644 --- a/core/database.py +++ b/core/database.py @@ -111,9 +111,13 @@ class NFOGuardDatabase: else: self._init_sqlite_tables(cursor) - # Test the connection works + # Test the connection works and verify autocommit cursor.execute("SELECT 1") - print(f"✅ Database initialized and connection verified: {self.db_type.upper()}") + if self.db_type == "postgresql": + print(f"✅ Database initialized and connection verified: {self.db_type.upper()}") + print(f"🔍 PostgreSQL autocommit status: {conn.autocommit}") + else: + print(f"✅ Database initialized and connection verified: {self.db_type.upper()}") def _init_postgresql_tables(self, cursor): """Initialize PostgreSQL tables""" @@ -306,6 +310,7 @@ class NFOGuardDatabase: has_video_file = EXCLUDED.has_video_file, last_updated = EXCLUDED.last_updated """, (imdb_id, season, episode, aired, dateadded, source, has_video_file, timestamp)) + print(f"🔍 DEBUG: PostgreSQL upsert executed for {imdb_id} S{season:02d}E{episode:02d}, rows affected: {cursor.rowcount}") else: cursor.execute(""" INSERT OR REPLACE INTO episodes