Updated both logger to use native column type

This commit is contained in:
Donald Zou
2025-05-05 20:34:08 +08:00
parent 6e6cd9a7e5
commit fc34c1fc35
4 changed files with 12 additions and 3 deletions

View File

@@ -1801,6 +1801,7 @@ class DashboardConfig:
"Database":{
"type": "sqlite",
"host": "",
"port": "",
"username": "",
"password": ""
},
@@ -1830,7 +1831,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