feat: update ics, first version working

This commit is contained in:
2025-09-05 15:24:53 -06:00
parent 81ec17d009
commit d53edfa8dd
7 changed files with 691 additions and 28 deletions

View File

@@ -0,0 +1,46 @@
"""add_ics_uid_to_calendar_event
Revision ID: a256772ef058
Revises: d4a1c446458c
Create Date: 2025-08-19 09:27:26.472456
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "a256772ef058"
down_revision: Union[str, None] = "d4a1c446458c"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("calendar_event", schema=None) as batch_op:
batch_op.add_column(sa.Column("ics_uid", sa.Text(), nullable=False))
batch_op.drop_constraint(batch_op.f("uq_room_calendar_event"), type_="unique")
batch_op.create_unique_constraint(
"uq_room_calendar_event", ["room_id", "ics_uid"]
)
batch_op.drop_column("external_id")
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("calendar_event", schema=None) as batch_op:
batch_op.add_column(
sa.Column("external_id", sa.TEXT(), autoincrement=False, nullable=True)
)
batch_op.drop_constraint("uq_room_calendar_event", type_="unique")
batch_op.create_unique_constraint(
batch_op.f("uq_room_calendar_event"), ["room_id", "external_id"]
)
batch_op.drop_column("ics_uid")
# ### end Alembic commands ###