From 501223e2728141072ce3de49d413d3c7846493e0 Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Tue, 1 Dec 2020 00:13:45 -0600 Subject: [PATCH] Added a delete database function --- src/database/sql_database.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/database/sql_database.py b/src/database/sql_database.py index a40217e..e16bcd1 100644 --- a/src/database/sql_database.py +++ b/src/database/sql_database.py @@ -9,6 +9,11 @@ class SQL_Database: sql_type_list = [int, float, str] + def __init__(self): + self.conn = None + self.config_id = None + self._database_name = 'database.db' + def default_config_id(method): """Decorator used to set the default config_id""" @@ -37,13 +42,6 @@ class SQL_Database: return new_method - - def __init__(self): - self.conn = None - self.config_id = None - self._database_name = 'database.db' - - def get_current_config(self): """Get the current config_id from the config table.""" return self.query_one_item("SELECT MAX(id) FROM config") @@ -226,6 +224,10 @@ class SQL_Database: cur.execute(query) return cur.fetchone() + def remove_database(self): + """Remove the current database file using the database_name attribute.""" + os.remove(self._database_name) + def past_runs(self): """Show a summerization of the past runs that the user has done."""