"""Add market_alerts table Revision ID: f44014715b40 Revises: 099810723175 Create Date: 2025-12-15 15:08:35.934280 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision: str = 'f44014715b40' down_revision: Union[str, Sequence[str], None] = '099810723175' branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: """Upgrade schema.""" # ### commands auto generated by Alembic - please adjust! ### op.create_table('market_alerts', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('ticker', sa.String(length=20), nullable=False), sa.Column('alert_type', sa.String(length=50), nullable=False), sa.Column('timestamp', sa.DateTime(), nullable=False), sa.Column('details', sa.JSON(), nullable=True), sa.Column('price', sa.DECIMAL(precision=15, scale=4), nullable=True), sa.Column('volume', sa.Integer(), nullable=True), sa.Column('change_pct', sa.DECIMAL(precision=10, scale=4), nullable=True), sa.Column('severity', sa.Integer(), nullable=True), sa.Column('source', sa.String(length=50), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.PrimaryKeyConstraint('id') ) op.create_index('ix_market_alerts_alert_type', 'market_alerts', ['alert_type'], unique=False) op.create_index(op.f('ix_market_alerts_ticker'), 'market_alerts', ['ticker'], unique=False) op.create_index('ix_market_alerts_ticker_timestamp', 'market_alerts', ['ticker', 'timestamp'], unique=False) op.create_index(op.f('ix_market_alerts_timestamp'), 'market_alerts', ['timestamp'], unique=False) # ### end Alembic commands ### def downgrade() -> None: """Downgrade schema.""" # ### commands auto generated by Alembic - please adjust! ### op.drop_index(op.f('ix_market_alerts_timestamp'), table_name='market_alerts') op.drop_index('ix_market_alerts_ticker_timestamp', table_name='market_alerts') op.drop_index(op.f('ix_market_alerts_ticker'), table_name='market_alerts') op.drop_index('ix_market_alerts_alert_type', table_name='market_alerts') op.drop_table('market_alerts') # ### end Alembic commands ###