"""add alert history table Revision ID: c8f3e9a2b4d1 Revises: b72debf55c3b Create Date: 2026-08-12 10:00:00.000000 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa import sqlmodel # revision identifiers, used by Alembic. revision: str = 'c8f3e9a2b4d1' down_revision: Union[str, Sequence[str], None] = 'b72debf55c3b' branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: """Upgrade schema.""" op.create_table( 'cron_pool_alert_history', sa.Column('id', sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column('alert_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column('severity', sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column('message', sqlmodel.sql.sqltypes.AutoString(), nullable=False), sa.Column('metric_value', sa.Float(), nullable=False), sa.Column('threshold', sa.Float(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('resolved_at', sa.DateTime(), nullable=True), sa.Column('webhook_sent', sa.Boolean(), nullable=False, default=False), sa.PrimaryKeyConstraint('id') ) with op.batch_alter_table('cron_pool_alert_history', schema=None) as batch_op: batch_op.create_index('ix_cron_pool_alert_history_alert_type', ['alert_type'], unique=False) batch_op.create_index('ix_cron_pool_alert_history_severity', ['severity'], unique=False) def downgrade() -> None: """Downgrade schema.""" with op.batch_alter_table('cron_pool_alert_history', schema=None) as batch_op: batch_op.drop_index('ix_cron_pool_alert_history_severity') batch_op.drop_index('ix_cron_pool_alert_history_alert_type') op.drop_table('cron_pool_alert_history')