Added a delete database function

This commit is contained in:
danielwilczak101
2020-12-01 00:13:45 -06:00
parent 63c4304f48
commit 501223e272

View File

@ -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."""