[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,16 +575,16 @@ class Cache:
with closing(connection.cursor()) as cursor: with closing(connection.cursor()) as cursor:
cursor.execute(f"SELECT * FROM image_maps WHERE library = ?", (library,)) cursor.execute(f"SELECT * FROM image_maps WHERE library = ?", (library,))
row = cursor.fetchone() 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"]: if row and row["key"]:
table_name = f"image_map_{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: else:
cursor.execute("INSERT OR IGNORE INTO image_maps(library) VALUES(?)", (library,)) cursor.execute("INSERT OR IGNORE INTO image_maps(library) VALUES(?)", (library,))
cursor.execute(f"SELECT * FROM image_maps WHERE library = ?", (library,)) cursor.execute(f"SELECT * FROM image_maps WHERE library = ?", (library,))
@ -607,6 +607,14 @@ class Cache:
compare TEXT, compare TEXT,
location 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 return table_name
def query_image_map(self, rating_key, table_name): def query_image_map(self, rating_key, table_name):

Loading…
Cancel
Save