+6
-1
@@ -111,8 +111,12 @@ class NFOGuardDatabase:
|
|||||||
else:
|
else:
|
||||||
self._init_sqlite_tables(cursor)
|
self._init_sqlite_tables(cursor)
|
||||||
|
|
||||||
# Test the connection works
|
# Test the connection works and verify autocommit
|
||||||
cursor.execute("SELECT 1")
|
cursor.execute("SELECT 1")
|
||||||
|
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()}")
|
print(f"✅ Database initialized and connection verified: {self.db_type.upper()}")
|
||||||
|
|
||||||
def _init_postgresql_tables(self, cursor):
|
def _init_postgresql_tables(self, cursor):
|
||||||
@@ -306,6 +310,7 @@ class NFOGuardDatabase:
|
|||||||
has_video_file = EXCLUDED.has_video_file,
|
has_video_file = EXCLUDED.has_video_file,
|
||||||
last_updated = EXCLUDED.last_updated
|
last_updated = EXCLUDED.last_updated
|
||||||
""", (imdb_id, season, episode, aired, dateadded, source, has_video_file, timestamp))
|
""", (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:
|
else:
|
||||||
cursor.execute("""
|
cursor.execute("""
|
||||||
INSERT OR REPLACE INTO episodes
|
INSERT OR REPLACE INTO episodes
|
||||||
|
|||||||
Reference in New Issue
Block a user