pounce/backend/alembic/versions/013_add_ops_alert_events.py
Yves Gugger bb7ce97330
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled
Deploy: referral rewards antifraud + legal contact updates
2025-12-15 13:56:43 +01:00

42 lines
1.4 KiB
Python

"""add ops alert events
Revision ID: 013_add_ops_alert_events
Revises: 012_add_telemetry_events
Create Date: 2025-12-15
"""
from __future__ import annotations
from alembic import op
import sqlalchemy as sa
revision = "013_add_ops_alert_events"
down_revision = "012_add_telemetry_events"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.create_table(
"ops_alert_events",
sa.Column("id", sa.Integer(), primary_key=True),
sa.Column("alert_key", sa.String(length=80), nullable=False),
sa.Column("severity", sa.String(length=10), nullable=False),
sa.Column("title", sa.String(length=200), nullable=False),
sa.Column("detail", sa.Text(), nullable=True),
sa.Column("status", sa.String(length=20), nullable=False),
sa.Column("recipients", sa.Text(), nullable=True),
sa.Column("send_reason", sa.String(length=60), nullable=True),
sa.Column("created_at", sa.DateTime(), nullable=False, server_default=sa.text("now()")),
)
op.create_index("ix_ops_alert_key_created", "ops_alert_events", ["alert_key", "created_at"])
op.create_index("ix_ops_alert_status_created", "ops_alert_events", ["status", "created_at"])
def downgrade() -> None:
op.drop_index("ix_ops_alert_status_created", table_name="ops_alert_events")
op.drop_index("ix_ops_alert_key_created", table_name="ops_alert_events")
op.drop_table("ops_alert_events")