"""Add System-2 risk mode (standard / aggressive). subscriptions.sys2_mode : user-selected mode ("standard" default) bot_trades.sys2_mode : frozen mode for the trade (NULL → standard) Aggressive is a separately-funded high-risk/high-explosiveness sleeve. Both modes keep the safety invariants (never exchange-liquidated; post-pyramid breakeven floor). Defaults make every existing row behave as before. Revision ID: 015 Revises: 014 Create Date: 2026-05-18 00:00:00.000000 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op revision: str = "015" down_revision: Union[str, None] = "014" branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: with op.batch_alter_table("subscriptions") as b: b.add_column(sa.Column("sys2_mode", sa.String(16), nullable=False, server_default="standard")) with op.batch_alter_table("bot_trades") as b: b.add_column(sa.Column("sys2_mode", sa.String(16), nullable=True)) def downgrade() -> None: with op.batch_alter_table("bot_trades") as b: b.drop_column("sys2_mode") with op.batch_alter_table("subscriptions") as b: b.drop_column("sys2_mode")