24 lines
524 B
Python
24 lines
524 B
Python
|
|
import os
|
||
|
|
import logging
|
||
|
|
from quote_db import QuoteDatabase
|
||
|
|
|
||
|
|
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
||
|
|
DB_PATH = "quotes.db"
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
try:
|
||
|
|
|
||
|
|
if os.path.exists(DB_PATH):
|
||
|
|
os.remove(DB_PATH)
|
||
|
|
logging.info(f"Deleted old database: {DB_PATH}")
|
||
|
|
|
||
|
|
|
||
|
|
my_class = QuoteDatabase()
|
||
|
|
my_class._create_tables()
|
||
|
|
|
||
|
|
logging.info(f"Fresh database has been created: {DB_PATH}")
|
||
|
|
except Exception as e:
|
||
|
|
logging.error(f"Error resetting database: {e}", exc_info=True)
|
||
|
|
|