"""Add expected_move column to kevin_stock_mentions (prompt v2). Adds the KevinExpectedMove enum and a NOT NULL column with default 'unknown' so existing rows keep loading. New analyses produced by the v2 prompt will populate it with a real directional view. Revision ID: e5f6a7b8c9d0 Revises: d4e5f6a7b8c9 Create Date: 2026-05-28 """ from __future__ import annotations import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql revision = "e5f6a7b8c9d0" down_revision = "d4e5f6a7b8c9" branch_labels = None depends_on = None _ENUM_NAME = "kevin_expected_move" _VALUES = ("up_strong", "up_mild", "sideways", "down_mild", "down_strong", "unknown") def upgrade() -> None: enum_type = postgresql.ENUM(*_VALUES, name=_ENUM_NAME, create_type=False) enum_type.create(op.get_bind(), checkfirst=True) op.add_column( "kevin_stock_mentions", sa.Column( "expected_move", enum_type, nullable=False, server_default="unknown", ), ) def downgrade() -> None: op.drop_column("kevin_stock_mentions", "expected_move") op.execute(f"DROP TYPE IF EXISTS {_ENUM_NAME}")