UMBRA/backend/alembic/versions/011_add_event_templates.py
Kyle Pope 80f3f3ed10 Calendar enhancements: scroll navigation, birthday color editing, event templates
- Add wheel scroll navigation in month view (debounced, prevents rapid scrolling)
- Allow editing color on system calendars (Birthdays) - name field disabled
- Event templates: full CRUD backend (model, schema, router, migration 011)
- Event templates: sidebar section with create/edit/delete, click to pre-fill EventForm
- Register event_templates router at /api/event-templates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 17:34:16 +08:00

41 lines
1.5 KiB
Python

"""add event_templates table
Revision ID: 011
Revises: 010
Create Date: 2026-02-22
"""
from alembic import op
import sqlalchemy as sa
revision = "011"
down_revision = "010"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.create_table(
"event_templates",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("name", sa.String(255), nullable=False),
sa.Column("title", sa.String(255), nullable=False),
sa.Column("description", sa.Text(), nullable=True),
sa.Column("duration_minutes", sa.Integer(), nullable=False, server_default="60"),
sa.Column("calendar_id", sa.Integer(), nullable=True),
sa.Column("recurrence_rule", sa.Text(), nullable=True),
sa.Column("all_day", sa.Boolean(), nullable=False, server_default="false"),
sa.Column("location_id", sa.Integer(), nullable=True),
sa.Column("is_starred", sa.Boolean(), nullable=False, server_default="false"),
sa.Column("created_at", sa.DateTime(), nullable=False, server_default=sa.func.now()),
sa.ForeignKeyConstraint(["calendar_id"], ["calendars.id"], ondelete="SET NULL"),
sa.ForeignKeyConstraint(["location_id"], ["locations.id"], ondelete="SET NULL"),
sa.PrimaryKeyConstraint("id"),
)
op.create_index("ix_event_templates_id", "event_templates", ["id"])
def downgrade() -> None:
op.drop_index("ix_event_templates_id", table_name="event_templates")
op.drop_table("event_templates")