2023-07-22 17:15:59 +01:00
|
|
|
#!/usr/bin/python3
|
|
|
|
import sqlite3
|
|
|
|
import sys
|
|
|
|
|
|
|
|
print("type n to cancel")
|
|
|
|
answer = input("delete user, what is user id?")
|
|
|
|
|
2024-04-29 00:15:40 +01:00
|
|
|
if answer == "n":
|
2023-07-22 17:15:59 +01:00
|
|
|
sys.exit()
|
|
|
|
|
2024-04-29 00:15:40 +01:00
|
|
|
|
2023-07-22 17:15:59 +01:00
|
|
|
def get_db_connection():
|
2024-04-29 00:15:40 +01:00
|
|
|
connection = sqlite3.connect("database.db")
|
|
|
|
connection.row_factory = sqlite3.Row
|
|
|
|
return connection
|
2023-07-22 17:15:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
print("deleting notes")
|
|
|
|
|
|
|
|
conn = get_db_connection()
|
|
|
|
notes = conn.execute("DELETE FROM notes WHERE creator = ?", (int(answer),))
|
|
|
|
conn.commit()
|
|
|
|
conn.close()
|
|
|
|
|
|
|
|
print("deleting account")
|
|
|
|
|
|
|
|
conn = get_db_connection()
|
|
|
|
conn.execute("DELETE FROM users WHERE id = ?", (int(answer),))
|
|
|
|
conn.commit()
|
|
|
|
conn.close()
|
|
|
|
|
2024-04-29 00:15:40 +01:00
|
|
|
print("success")
|