"""add regime_snapshots table Stores the daily AI/Tech regime-change index (one row per date) so the monitor tab can show a 7/30-day trend. Standalone, observational feature: no other table or job reads this. Revision ID: 011 Revises: 010 Create Date: 2026-06-26 00:00:00.000000 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision: str = "011" down_revision: Union[str, None] = "010" branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: op.create_table( "regime_snapshots", sa.Column("id", sa.Integer(), nullable=False), sa.Column("date", sa.Date(), nullable=False), sa.Column("total_score", sa.Float(), nullable=False), sa.Column("band", sa.String(length=20), nullable=False), sa.Column("breakdown_json", sa.Text(), nullable=False), sa.Column("created_at", sa.DateTime(timezone=True), nullable=False), sa.PrimaryKeyConstraint("id"), ) op.create_index( "uq_regime_snapshots_date", "regime_snapshots", ["date"], unique=True ) def downgrade() -> None: op.drop_index("uq_regime_snapshots_date", table_name="regime_snapshots") op.drop_table("regime_snapshots")