[5] fix tables

pull/858/head
meisnate12 3 years ago
parent 7f5c066229
commit 74083a68d3

@ -1 +1 @@
1.16.5-develop4
1.16.5-develop5

@ -575,6 +575,8 @@ class Cache:
with closing(connection.cursor()) as cursor:
cursor.execute(f"SELECT * FROM image_maps WHERE library = ?", (library,))
row = cursor.fetchone()
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,
@ -583,8 +585,6 @@ class Cache:
compare TEXT,
location TEXT)"""
)
if row and row["key"]:
table_name = f"image_map_{row['key']}"
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):

Loading…
Cancel
Save