[rewrite] Work on user registration, slightly polished schemas structure

This commit is contained in:
Thastertyn committed 2025-02-24 19:02:39 +01:00
1 parent 5d12391635
commit 9e56eeca3f
12 files changed
+381 -39

No files matched your search

+3 -3
View File
@@ -12,20 +12,20 @@ class DatabaseManager():
_instance: 'DatabaseManager' = None
def __new__(cls, *args, **kwargs):
def __new__(cls, mysql_user: str, mysql_password: str, mysql_host: str, mysql_port: int, mysql_db_name: str):
if cls._instance is None:
cls._instance = super().__new__(cls)
return cls._instance
def __init__(self, mysql_user: str, mysql_password: str, mysql_host: str, mysql_port: str, mysql_db_name: str) -> None:
def __init__(self, mysql_user: str, mysql_password: str, mysql_host: str, mysql_port: int, mysql_db_name: str) -> None:
self.logger = logging.getLogger(__name__)
self.logger.info("Reading database config")
self.engine = create_engine('mysql+mysqlconnector://%s:%s@%s:%s/%s' % (
mysql_user,
mysql_password,
mysql_host,
mysql_port,
str(mysql_port),
mysql_db_name),
pool_pre_ping=True)
self.test_connection()