fix: alembic upgrade

This commit is contained in:
2025-08-04 11:15:43 -06:00
parent 8b644384a2
commit 06869ef5ca

View File

@@ -1,8 +1,8 @@
"""add platform support """dailyco platform
Revision ID: 20250801180012 Revision ID: 7e47155afd51
Revises: b0e5f7876032 Revises: b7df9609542c
Create Date: 2025-08-01 18:00:12.000000 Create Date: 2025-08-04 11:14:19.663115
""" """
@@ -12,30 +12,43 @@ import sqlalchemy as sa
from alembic import op from alembic import op
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision: str = "20250801180012" revision: str = "7e47155afd51"
down_revision: Union[str, None] = "b0e5f7876032" down_revision: Union[str, None] = "b7df9609542c"
branch_labels: Union[str, Sequence[str], None] = None branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None: def upgrade() -> None:
# Add platform column to rooms table # ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("meeting", schema=None) as batch_op:
batch_op.add_column(
sa.Column("platform", sa.String(), server_default="whereby", nullable=False)
)
batch_op.drop_index(
batch_op.f("idx_one_active_meeting_per_room"),
sqlite_where=sa.text("is_active = 1"),
)
with op.batch_alter_table("room", schema=None) as batch_op: with op.batch_alter_table("room", schema=None) as batch_op:
batch_op.add_column( batch_op.add_column(
sa.Column("platform", sa.String(), server_default="whereby", nullable=False) sa.Column("platform", sa.String(), server_default="whereby", nullable=False)
) )
# Add platform column to meeting table # ### end Alembic commands ###
with op.batch_alter_table("meeting", schema=None) as batch_op:
batch_op.add_column(
sa.Column("platform", sa.String(), server_default="whereby", nullable=False)
)
def downgrade() -> None: def downgrade() -> None:
# Remove platform columns # ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("meeting", schema=None) as batch_op:
batch_op.drop_column("platform")
with op.batch_alter_table("room", schema=None) as batch_op: with op.batch_alter_table("room", schema=None) as batch_op:
batch_op.drop_column("platform") batch_op.drop_column("platform")
with op.batch_alter_table("meeting", schema=None) as batch_op:
batch_op.create_index(
batch_op.f("idx_one_active_meeting_per_room"),
["room_id"],
unique=1,
sqlite_where=sa.text("is_active = 1"),
)
batch_op.drop_column("platform")
# ### end Alembic commands ###