From 9b8ba01df2803170110c6149d8da8c03caf83f2c Mon Sep 17 00:00:00 2001 From: FrederikBaerentsen Date: Wed, 17 Apr 2024 22:43:02 +0200 Subject: [PATCH] Added delete to helper script --- database.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/database.py b/database.py index ba78213..f89fbd9 100644 --- a/database.py +++ b/database.py @@ -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,