| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- """add trace spans
- Revision ID: 20260423_0005
- Revises: 20260423_0004
- Create Date: 2026-04-23 18:00:00
- """
- from collections.abc import Sequence
- from alembic import op
- import sqlalchemy as sa
- revision: str = "20260423_0005"
- down_revision: str | None = "20260423_0004"
- branch_labels: Sequence[str] | None = None
- depends_on: Sequence[str] | None = None
- def upgrade() -> None:
- op.create_table(
- "trace_span",
- sa.Column("run_id", sa.String(length=36), nullable=False),
- sa.Column("node_run_id", sa.String(length=36), nullable=True),
- sa.Column("parent_span_id", sa.String(length=36), nullable=True),
- sa.Column("span_type", sa.String(length=64), nullable=False),
- sa.Column("name", sa.String(length=128), nullable=False),
- sa.Column("status", sa.String(length=32), nullable=False),
- sa.Column("started_time", sa.DateTime(), nullable=False),
- sa.Column("ended_time", sa.DateTime(), nullable=True),
- sa.Column("duration_ms", sa.Integer(), nullable=True),
- sa.Column("attributes_json", sa.JSON(), nullable=True),
- sa.Column("error_code", sa.String(length=64), nullable=True),
- sa.Column("error_message", sa.Text(), nullable=True),
- sa.Column("id", sa.String(length=36), nullable=False),
- sa.Column("tenant_id", sa.String(length=36), nullable=False),
- sa.Column("created_by", sa.String(length=36), nullable=True),
- sa.Column("updated_by", sa.String(length=36), nullable=True),
- sa.Column("created_time", sa.DateTime(), nullable=False),
- sa.Column("updated_time", sa.DateTime(), nullable=False),
- sa.Column("deleted_time", sa.DateTime(), nullable=True),
- sa.Column("version", sa.Integer(), nullable=False),
- sa.PrimaryKeyConstraint("id"),
- )
- op.create_index("ix_trace_span_run_id", "trace_span", ["run_id"], unique=False)
- op.create_index("ix_trace_span_node_run_id", "trace_span", ["node_run_id"], unique=False)
- op.create_index("ix_trace_span_parent_span_id", "trace_span", ["parent_span_id"], unique=False)
- op.create_index("ix_trace_span_span_type", "trace_span", ["span_type"], unique=False)
- op.create_index("ix_trace_span_status", "trace_span", ["status"], unique=False)
- op.create_index("ix_trace_span_tenant_id", "trace_span", ["tenant_id"], unique=False)
- def downgrade() -> None:
- op.drop_index("ix_trace_span_tenant_id", table_name="trace_span")
- op.drop_index("ix_trace_span_status", table_name="trace_span")
- op.drop_index("ix_trace_span_span_type", table_name="trace_span")
- op.drop_index("ix_trace_span_parent_span_id", table_name="trace_span")
- op.drop_index("ix_trace_span_node_run_id", table_name="trace_span")
- op.drop_index("ix_trace_span_run_id", table_name="trace_span")
- op.drop_table("trace_span")
|