diff --git a/bot/src/bot_core/service/data_integrity_service.py b/bot/src/bot_core/service/data_integrity_service.py index fc044a9d..eba805e1 100644 --- a/bot/src/bot_core/service/data_integrity_service.py +++ b/bot/src/bot_core/service/data_integrity_service.py @@ -176,7 +176,7 @@ class DataIntegrityService: self._logger.warn(__name__, f"User not found in database: {u.id}") self._logger.debug(__name__, f"Add user: {u.id}") - self._users.add_user(User(u.id, 0, 0, 0, server)) + self._users.add_user(User(u.id, 0, 0, 0, None, server)) self._db_context.save_changes() self._logger.debug(__name__, f"Added User: {u.id}") diff --git a/bot/src/bot_data/model/user.py b/bot/src/bot_data/model/user.py index ed44c58a..c5766eb6 100644 --- a/bot/src/bot_data/model/user.py +++ b/bot/src/bot_data/model/user.py @@ -191,7 +191,7 @@ class User(TableABC): {self._xp}, {self._message_count}, {self._reaction_count}, - '{self._birthday}', + {"NULL" if self._birthday is None else f"'{self._birthday}'"}, {self._server.id} ); """ @@ -205,7 +205,7 @@ class User(TableABC): SET `XP` = {self._xp}, `MessageCount` = {self._message_count}, `ReactionCount` = {self._reaction_count}, - `Birthday` = '{self._birthday}' + `Birthday` = {"NULL" if self._birthday is None else f"'{self._birthday}'"} WHERE `UserId` = {self._user_id}; """ ) diff --git a/bot/src/bot_data/service/migration_service.py b/bot/src/bot_data/service/migration_service.py index dc6436a7..ab347283 100644 --- a/bot/src/bot_data/service/migration_service.py +++ b/bot/src/bot_data/service/migration_service.py @@ -21,7 +21,7 @@ class MigrationService: self._cursor = db.cursor self._migrations: List[MigrationABC] = ( - List(type, MigrationABC.__subclasses__()).order_by(lambda x: x.name).order_by(lambda x: x.prio) + List(type, MigrationABC.__subclasses__()).order_by(lambda x: x.name.split("_")[0]).then_by(lambda x: x.prio) ) def migrate(self):