"""аллокация портфеля Revision ID: a99f438e0010 Revises: b7424afbb5e2 Create Date: 2026-09-18 13:48:30.529174 """ from __future__ import annotations from collections.abc import Sequence import sqlalchemy as sa from alembic import op revision: str = "a99f438e0010" down_revision: str | None = "b7424afbb5e2" branch_labels: str | Sequence[str] | None = None depends_on: str | Sequence[str] | None = None def upgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.create_table( "metric_allocation", sa.Column("id", sa.Integer(), nullable=False), sa.Column("scope", sa.String(length=32), nullable=False), sa.Column( "dimension", sa.Enum("asset_class", "sector", "country", "currency", name="allocation_dimension"), nullable=False, ), sa.Column("bucket", sa.String(length=64), nullable=False), sa.Column("value_rub", sa.Numeric(precision=24, scale=10), nullable=False), sa.Column("weight", sa.Numeric(precision=24, scale=10), nullable=False), sa.Column("holding_count", sa.Integer(), nullable=False), sa.Column( "computed_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False, ), sa.PrimaryKeyConstraint("id", name=op.f("pk_metric_allocation")), sa.UniqueConstraint( "scope", "dimension", "bucket", name=op.f("uq_metric_allocation_scope_dimension_bucket") ), ) op.create_index( op.f("ix_metric_allocation_scope"), "metric_allocation", ["scope"], unique=False ) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_index(op.f("ix_metric_allocation_scope"), table_name="metric_allocation") op.drop_table("metric_allocation") # ### end Alembic commands ###