Updated both logger to use native column type

This commit is contained in:
Donald Zou
2025-05-05 20:34:08 +08:00
parent 196dc78b4f
commit 409acc9f1a
4 changed files with 12 additions and 3 deletions

View File

@@ -1805,6 +1805,7 @@ class DashboardConfig:
"Database":{
"type": "sqlite",
"host": "",
"port": "",
"username": "",
"password": ""
},
@@ -1834,7 +1835,7 @@ class DashboardConfig:
def getConnectionString(self, database) -> str or None:
if self.GetConfig("Database", "type")[1] == "sqlite":
return f'sqlite:///{os.path.join(CONFIGURATION_PATH, "db", f".db")}'
return f'sqlite:///{os.path.join(CONFIGURATION_PATH, "db", f"{database}.db")}'
elif self.GetConfig("Database", "type")[1] == "postgresql":
return f'postgresql+psycopg2://{self.GetConfig("Database", "username")[1]}:{self.GetConfig("Database", "password")[1]}@{self.GetConfig("Database", "host")[1]}/{database}'
return None