From 74083a68d3f90be1a25539fcd4fc5f4463a470c7 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 19 Apr 2022 10:14:38 -0400 Subject: [PATCH] [5] fix tables --- VERSION | 2 +- modules/cache.py | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/VERSION b/VERSION index 0676dea1..f1c8a638 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.5-develop4 +1.16.5-develop5 diff --git a/modules/cache.py b/modules/cache.py index 642b8210..a6ed4dc2 100644 --- a/modules/cache.py +++ b/modules/cache.py @@ -575,16 +575,16 @@ class Cache: with closing(connection.cursor()) as cursor: cursor.execute(f"SELECT * FROM image_maps WHERE library = ?", (library,)) row = cursor.fetchone() - cursor.execute( - f"""CREATE TABLE IF NOT EXISTS {table_name}_overlays ( - key INTEGER PRIMARY KEY, - rating_key TEXT UNIQUE, - overlay TEXT, - compare TEXT, - location TEXT)""" - ) if row and row["key"]: table_name = f"image_map_{row['key']}" + cursor.execute( + f"""CREATE TABLE IF NOT EXISTS {table_name}_overlays ( + key INTEGER PRIMARY KEY, + rating_key TEXT UNIQUE, + overlay TEXT, + compare TEXT, + location TEXT)""" + ) else: cursor.execute("INSERT OR IGNORE INTO image_maps(library) VALUES(?)", (library,)) cursor.execute(f"SELECT * FROM image_maps WHERE library = ?", (library,)) @@ -607,6 +607,14 @@ class Cache: compare TEXT, location TEXT)""" ) + cursor.execute( + f"""CREATE TABLE IF NOT EXISTS {table_name}_overlays ( + key INTEGER PRIMARY KEY, + rating_key TEXT UNIQUE, + overlay TEXT, + compare TEXT, + location TEXT)""" + ) return table_name def query_image_map(self, rating_key, table_name):