From d1298606f3f776401c55f25b65690e897bdc18f5 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 7 Dec 2021 16:42:47 +0100 Subject: [PATCH] Removed get_create_table_string --- src/gismo_data/model/client.py | 19 ------------------- src/gismo_data/model/known_user.py | 12 ------------ src/gismo_data/model/server.py | 12 ------------ src/gismo_data/model/user.py | 15 --------------- src/gismo_data/model/user_joined_server.py | 15 --------------- .../service/known_user_repository_service.py | 2 -- 6 files changed, 75 deletions(-) diff --git a/src/gismo_data/model/client.py b/src/gismo_data/model/client.py index 9048ea4..61e6a6c 100644 --- a/src/gismo_data/model/client.py +++ b/src/gismo_data/model/client.py @@ -63,25 +63,6 @@ class Client(TableABC): def server(self) -> Server: return self._server - @staticmethod - def get_create_string() -> str: - return str(f""" - CREATE TABLE IF NOT EXISTS `Clients` ( - `ClientId` BIGINT NOT NULL AUTO_INCREMENT, - `DiscordClientId` BIGINT NOT NULL, - `SentMessageCount` BIGINT NOT NULL DEFAULT 0, - `ReceivedMessageCount` BIGINT NOT NULL DEFAULT 0, - `DeletedMessageCount` BIGINT NOT NULL DEFAULT 0, - `ReceivedCommandsCount` BIGINT NOT NULL DEFAULT 0, - `MovedUsersCount` BIGINT NOT NULL DEFAULT 0, - `ServerId` BIGINT, - `CreatedAt` DATETIME(6), - `LastModifiedAt` DATETIME(6), - FOREIGN KEY (`ServerId`) REFERENCES Servers(`ServerId`), - PRIMARY KEY(`ClientId`) - ); - """) - @staticmethod def get_select_all_string() -> str: return str(f""" diff --git a/src/gismo_data/model/known_user.py b/src/gismo_data/model/known_user.py index 73ff562..7dcda21 100644 --- a/src/gismo_data/model/known_user.py +++ b/src/gismo_data/model/known_user.py @@ -23,18 +23,6 @@ class KnownUser(TableABC): def discord_id(self) -> int: return self._discord_id - @staticmethod - def get_create_string() -> str: - return str(f""" - CREATE TABLE IF NOT EXISTS `KnownUsers` ( - `KnownUserId` BIGINT NOT NULL AUTO_INCREMENT, - `DiscordId` BIGINT NOT NULL, - `CreatedAt` DATETIME(6), - `LastModifiedAt` DATETIME(6), - PRIMARY KEY(`KnownUserId`) - ); - """) - @staticmethod def get_select_all_string() -> str: return str(f""" diff --git a/src/gismo_data/model/server.py b/src/gismo_data/model/server.py index 5f9e9e5..14cddef 100644 --- a/src/gismo_data/model/server.py +++ b/src/gismo_data/model/server.py @@ -21,18 +21,6 @@ class Server(TableABC): @property def discord_server_id(self) -> int: return self._discord_server_id - - @staticmethod - def get_create_string() -> str: - return str(f""" - CREATE TABLE IF NOT EXISTS `Servers` ( - `ServerId` BIGINT NOT NULL AUTO_INCREMENT, - `DiscordServerId` BIGINT NOT NULL, - `CreatedAt` DATETIME(6), - `LastModifiedAt` DATETIME(6), - PRIMARY KEY(`ServerId`) - ); - """) @staticmethod def get_select_all_string() -> str: diff --git a/src/gismo_data/model/user.py b/src/gismo_data/model/user.py index 2fae830..f133f1a 100644 --- a/src/gismo_data/model/user.py +++ b/src/gismo_data/model/user.py @@ -38,21 +38,6 @@ class User(TableABC): def server(self) -> Optional[Server]: return self._server - @staticmethod - def get_create_string() -> str: - return str(f""" - CREATE TABLE IF NOT EXISTS `Users` ( - `UserId` BIGINT NOT NULL AUTO_INCREMENT, - `DiscordId` BIGINT NOT NULL, - `XP` BIGINT NOT NULL DEFAULT 0, - `ServerId` BIGINT, - `CreatedAt` DATETIME(6), - `LastModifiedAt` DATETIME(6), - FOREIGN KEY (`ServerId`) REFERENCES Servers(`ServerId`), - PRIMARY KEY(`UserId`) - ); - """) - @staticmethod def get_select_all_string() -> str: return str(f""" diff --git a/src/gismo_data/model/user_joined_server.py b/src/gismo_data/model/user_joined_server.py index f0fe206..5c6f13e 100644 --- a/src/gismo_data/model/user_joined_server.py +++ b/src/gismo_data/model/user_joined_server.py @@ -34,21 +34,6 @@ class UserJoinedServer(TableABC): @property def leaved_on(self) -> datetime: return self._leaved_on - - @staticmethod - def get_create_string() -> str: - return str(f""" - CREATE TABLE IF NOT EXISTS `UserJoinedServers` ( - `JoinId` BIGINT NOT NULL AUTO_INCREMENT, - `UserId` BIGINT NOT NULL, - `JoinedOn` DATETIME(6) NOT NULL, - `LeavedOn` DATETIME(6), - `CreatedAt` DATETIME(6), - `LastModifiedAt` DATETIME(6), - FOREIGN KEY (`UserId`) REFERENCES Users(`UserId`), - PRIMARY KEY(`JoinId`) - ); - """) @staticmethod def get_select_all_string() -> str: diff --git a/src/gismo_data/service/known_user_repository_service.py b/src/gismo_data/service/known_user_repository_service.py index d349ea5..d85b44c 100644 --- a/src/gismo_data/service/known_user_repository_service.py +++ b/src/gismo_data/service/known_user_repository_service.py @@ -65,8 +65,6 @@ class KnownUserRepositoryService(KnownUserRepositoryABC): result[1], result[2], result[3], - result[4], - self._servers.get_server_by_id(result[3]), id=result[0] )