From 67fe61d42dd1c114cf4f35120687199027b54b24 Mon Sep 17 00:00:00 2001 From: Mitchell Clark Date: Sat, 24 Aug 2024 19:02:13 +1000 Subject: [PATCH] feat: simple destroy database function --- client/data/routines.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/data/routines.py b/client/data/routines.py index 2c1e8cd..6950220 100644 --- a/client/data/routines.py +++ b/client/data/routines.py @@ -61,6 +61,12 @@ def init_database() -> None: connection.commit() +def destroy_database() -> None: + """Delete the current database if it exists.""" + with resources.as_file(DATABASE_RESOURCE) as database_file: + database_file.unlink(missing_ok=True) + + def create_user() -> int: """Creates a new user in the database.