Added delete to helper script

This commit is contained in:
FrederikBaerentsen 2024-04-17 22:43:02 +02:00
parent 481e579b59
commit 9b8ba01df2

View File

@ -1,9 +1,30 @@
import sqlite3
from pathlib import Path # creating folders
import sys
conn = sqlite3.connect('app.db')
cursor = conn.cursor()
if len(sys.argv) > 1:
cursor.execute('DELETE FROM sets where u_id="' +sys.argv[1]+ '";')
conn.commit()
cursor.execute('DELETE FROM inventory where u_id="' +sys.argv[1]+ '";')
conn.commit()
cursor.execute('DELETE FROM minifigures where u_id="' +sys.argv[1]+ '";')
conn.commit()
cursor.execute('DELETE FROM missing where u_id="' +sys.argv[1]+ '";')
conn.commit()
cursor.close()
conn.close()
exit()
@ -40,6 +61,7 @@ cursor.execute('''CREATE TABLE IF NOT EXISTS inventory (
)''')
cursor.execute('''CREATE TABLE IF NOT EXISTS minifigures (
fig_num TEXT,
set_num TEXT,
name TEXT,
quantity INTEGER,