Refactor database management and schema initialization

- Removed the old npc_memory.db file.
- Updated time.txt with a new timestamp.
- Refactored transaction recording in bank_functions.py to use parameterized queries.
- Enhanced DatabaseManager in sql_commands.py to support singleton pattern and improved table creation logic.
- Added methods for sanitizing SQL identifiers and parsing insert columns for upsert operations.
- Improved error handling and connection management in execute_query, fetch_one, fetch_all, and fetch_as_dataframe methods.
- Introduced a new bootstrap_database.py script for initializing the database schema.
- Updated app.py to use the new initialize_database function for database management.
This commit is contained in:
2026-05-31 11:16:44 +00:00
parent a6094c2d0c
commit be89cc3acd
11 changed files with 2175 additions and 53 deletions
+2 -1
View File
@@ -4,6 +4,7 @@ from discord.ext import commands
import os
from dotenv import load_dotenv
from web.app import app
from utils.sql_commands import initialize_database
import threading
import itertools
@@ -50,9 +51,9 @@ class Client(commands.Bot):
def main():
load_dotenv()
initialize_database()
client = Client()
token = os.getenv("TOKEN")
print(token)
if token is not None:
threading.Thread(target=run_web, daemon=True).start()
client.run(token)