From a85c2e5468a98e4fb826af2324c3dc4f2d70ce8d Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Fri, 27 Mar 2026 01:03:40 -0500 Subject: [PATCH] fix: align CustomCommandCreator.discord_id model with BIGINT column (#78) Closes #78 Change CharField(max_length=20) to BigIntegerField to match the BIGINT column created by the migration. Remove the str() workaround in get_creator_by_discord_id() that was compensating for the type mismatch. Co-Authored-By: Claude Sonnet 4.6 --- app/db_engine.py | 2 +- app/routers_v3/custom_commands.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/db_engine.py b/app/db_engine.py index c1979cf..245fcc2 100644 --- a/app/db_engine.py +++ b/app/db_engine.py @@ -2224,7 +2224,7 @@ class Decision(BaseModel): class CustomCommandCreator(BaseModel): """Model for custom command creators.""" - discord_id = CharField(max_length=20, unique=True) # Discord snowflake ID as string + discord_id = BigIntegerField(unique=True) username = CharField(max_length=32) display_name = CharField(max_length=32, null=True) created_at = DateTimeField() diff --git a/app/routers_v3/custom_commands.py b/app/routers_v3/custom_commands.py index 577e78d..652f998 100644 --- a/app/routers_v3/custom_commands.py +++ b/app/routers_v3/custom_commands.py @@ -175,7 +175,7 @@ def delete_custom_command(command_id: int): def get_creator_by_discord_id(discord_id: int): """Get a creator by Discord ID""" creator = CustomCommandCreator.get_or_none( - CustomCommandCreator.discord_id == str(discord_id) + CustomCommandCreator.discord_id == discord_id ) if creator: return model_to_dict(creator)