Fixed add user
All checks were successful
Deploy dev on push / on-push-deploy_sh-edraft (push) Successful in 4m4s

This commit is contained in:
Sven Heidemann 2023-10-22 16:29:24 +02:00
parent 3360baad6c
commit d09a13f0ee
3 changed files with 4 additions and 4 deletions

View File

@ -176,7 +176,7 @@ class DataIntegrityService:
self._logger.warn(__name__, f"User not found in database: {u.id}") self._logger.warn(__name__, f"User not found in database: {u.id}")
self._logger.debug(__name__, f"Add user: {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._db_context.save_changes()
self._logger.debug(__name__, f"Added User: {u.id}") self._logger.debug(__name__, f"Added User: {u.id}")

View File

@ -191,7 +191,7 @@ class User(TableABC):
{self._xp}, {self._xp},
{self._message_count}, {self._message_count},
{self._reaction_count}, {self._reaction_count},
'{self._birthday}', {"NULL" if self._birthday is None else f"'{self._birthday}'"},
{self._server.id} {self._server.id}
); );
""" """
@ -205,7 +205,7 @@ class User(TableABC):
SET `XP` = {self._xp}, SET `XP` = {self._xp},
`MessageCount` = {self._message_count}, `MessageCount` = {self._message_count},
`ReactionCount` = {self._reaction_count}, `ReactionCount` = {self._reaction_count},
`Birthday` = '{self._birthday}' `Birthday` = {"NULL" if self._birthday is None else f"'{self._birthday}'"}
WHERE `UserId` = {self._user_id}; WHERE `UserId` = {self._user_id};
""" """
) )

View File

@ -21,7 +21,7 @@ class MigrationService:
self._cursor = db.cursor self._cursor = db.cursor
self._migrations: List[MigrationABC] = ( 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): def migrate(self):