From 526f74e54bacd001f72a2da687be960e4225a733 Mon Sep 17 00:00:00 2001 From: aniebietafia Date: Sat, 6 Jun 2026 22:44:29 +0100 Subject: [PATCH] fix(meeting): increase Participant role column length to prevent admission failures - Update the Participant model's role column to String(20) to accommodate the 11-character "participant" role. - Add Alembic migration to update the column length limit in the database. - Fixes the "Failed to admit" error when hosts admit authenticated users from locked lobbies. Signed-off-by: aniebietafia --- ...61566e_increase_participant_role_length.py | 44 +++++++++++++++++++ app/modules/meeting/models.py | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 alembic/versions/96532f61566e_increase_participant_role_length.py diff --git a/alembic/versions/96532f61566e_increase_participant_role_length.py b/alembic/versions/96532f61566e_increase_participant_role_length.py new file mode 100644 index 0000000..ebc9ee8 --- /dev/null +++ b/alembic/versions/96532f61566e_increase_participant_role_length.py @@ -0,0 +1,44 @@ +"""increase_participant_role_length + +Revision ID: 96532f61566e +Revises: 91cf98820af0 +Create Date: 2026-06-06 22:34:47.445999 + +""" + +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + +# revision identifiers, used by Alembic. +revision: str = "96532f61566e" +down_revision: Union[str, Sequence[str], None] = "91cf98820af0" +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + """Upgrade schema.""" + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column( + "participants", + "role", + existing_type=sa.VARCHAR(length=10), + type_=sa.String(length=20), + existing_nullable=False, + ) + # ### end Alembic commands ### + + +def downgrade() -> None: + """Downgrade schema.""" + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column( + "participants", + "role", + existing_type=sa.String(length=20), + type_=sa.VARCHAR(length=10), + existing_nullable=False, + ) + # ### end Alembic commands ### diff --git a/app/modules/meeting/models.py b/app/modules/meeting/models.py index a41fea1..5faa103 100644 --- a/app/modules/meeting/models.py +++ b/app/modules/meeting/models.py @@ -101,7 +101,7 @@ class Participant(Base): left_at: Mapped[datetime | None] = mapped_column( DateTime(timezone=True), nullable=True ) - role: Mapped[str] = mapped_column(String(10), default="guest", nullable=False) + role: Mapped[str] = mapped_column(String(20), default="guest", nullable=False) __table_args__ = ( UniqueConstraint("room_id", "user_id", name="uq_participant_room_user"),