fix: alembic migrations (#470)

* fix: alembic migrations

This commit fixes all the migrations that was half-backed, due to auto
creation in the db init before. The process was to checkout at the
commit where the migration was created, and use --autogenerate to
regenerate at the state of the migration. 4 migrations was fixed.

It also includes a workflow to ensure migration can applies correctly.

* fix: db migration check

* fix: nullable on meeting_consent

* fix: try fixing tests
This commit is contained in:
2025-06-27 12:03:10 -06:00
committed by GitHub
parent 9f70f76557
commit 3d370336cc
7 changed files with 174 additions and 188 deletions

View File

@@ -1,15 +1,16 @@
"""Add room options
"""add room options
Revision ID: 62dea3db63a5
Revises: 1340c04426b8
Create Date: 2024-09-03 16:19:26.861027
Create Date: 2025-06-27 09:04:21.006823
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "62dea3db63a5"
@@ -20,67 +21,63 @@ depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
op.create_table(
"meeting",
sa.Column("id", sa.String(), nullable=False),
sa.Column("room_name", sa.String(), nullable=True),
sa.Column("room_url", sa.String(), nullable=True),
sa.Column("host_room_url", sa.String(), nullable=True),
sa.Column("viewer_room_url", sa.String(), nullable=True),
sa.Column("start_date", sa.DateTime(), nullable=True),
sa.Column("end_date", sa.DateTime(), nullable=True),
sa.Column("user_id", sa.String(), nullable=True),
sa.Column("room_id", sa.String(), nullable=True),
sa.Column(
"is_locked", sa.Boolean(), server_default=sa.text("0"), nullable=False
),
)
op.add_column(
"meeting",
sa.Column("room_mode", sa.String(), server_default="normal", nullable=False),
)
op.add_column(
"meeting",
sa.Column(
"recording_type", sa.String(), server_default="cloud", nullable=False
),
)
op.add_column(
"meeting",
sa.Column(
"recording_trigger",
sa.String(),
server_default="automatic-2nd-participant",
nullable=False,
),
sa.PrimaryKeyConstraint("id"),
)
op.add_column(
op.create_table(
"room",
sa.Column("id", sa.String(), nullable=False),
sa.Column("name", sa.String(), nullable=False),
sa.Column("user_id", sa.String(), nullable=False),
sa.Column("created_at", sa.DateTime(), nullable=False),
sa.Column(
"zulip_auto_post", sa.Boolean(), server_default=sa.text("0"), nullable=False
),
sa.Column("zulip_stream", sa.String(), nullable=True),
sa.Column("zulip_topic", sa.String(), nullable=True),
sa.Column(
"is_locked", sa.Boolean(), server_default=sa.text("0"), nullable=False
),
)
op.add_column(
"room",
sa.Column("room_mode", sa.String(), server_default="normal", nullable=False),
)
op.add_column(
"room",
sa.Column(
"recording_type", sa.String(), server_default="cloud", nullable=False
),
)
op.add_column(
"room",
sa.Column(
"recording_trigger",
sa.String(),
server_default="automatic-2nd-participant",
nullable=False,
),
sa.PrimaryKeyConstraint("id"),
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("room", "recording_trigger")
op.drop_column("room", "recording_type")
op.drop_column("room", "room_mode")
op.drop_column("room", "is_locked")
op.drop_column("meeting", "recording_trigger")
op.drop_column("meeting", "recording_type")
op.drop_column("meeting", "room_mode")
op.drop_column("meeting", "is_locked")
op.drop_table("room")
op.drop_table("meeting")
# ### end Alembic commands ###