feat(scheduling): persist bounded cancellation notices
This commit is contained in:
@@ -53,6 +53,7 @@ class SchedulingRequest(Base, TimestampMixin):
|
||||
calendar_event_id: Mapped[str | None] = mapped_column(String(36), nullable=True, index=True)
|
||||
handed_off_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
cancelled_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
cancellation_notice_until: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
deleted_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True, index=True)
|
||||
metadata_: Mapped[dict[str, Any] | None] = mapped_column("metadata", JSON, nullable=True)
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
"""v0.1.11 bounded scheduling cancellation notice
|
||||
|
||||
Revision ID: c9d4e7f1a2b3
|
||||
Revises: be8f4d2c1a70
|
||||
Create Date: 2026-07-22 00:00:00.000000
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "c9d4e7f1a2b3"
|
||||
down_revision = "be8f4d2c1a70"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
inspector = sa.inspect(op.get_bind())
|
||||
columns = {
|
||||
item["name"]: item
|
||||
for item in inspector.get_columns("scheduling_requests")
|
||||
}
|
||||
existing = columns.get("cancellation_notice_until")
|
||||
if existing is not None:
|
||||
if (
|
||||
not existing.get("nullable")
|
||||
or not isinstance(existing["type"], sa.DateTime)
|
||||
):
|
||||
raise RuntimeError(
|
||||
"Cannot adopt scheduling_requests.cancellation_notice_until "
|
||||
"because its schema is unexpected"
|
||||
)
|
||||
return
|
||||
op.add_column(
|
||||
"scheduling_requests",
|
||||
sa.Column("cancellation_notice_until", sa.DateTime(timezone=True), nullable=True),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("scheduling_requests", "cancellation_notice_until")
|
||||
Reference in New Issue
Block a user