-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0008_observability_usage_cost.py
More file actions
43 lines (34 loc) · 1.14 KB
/
Copy path0008_observability_usage_cost.py
File metadata and controls
43 lines (34 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""0008 observability usage cost
Revision ID: 0008_observability_usage_cost
Revises: 0007_workflow_tables
Create Date: 2026-08-08
Epic 07 Phase 5: additive ``cost_usd`` / ``pricing_version`` on ``usage_events``.
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
revision: str = "0008_observability_usage_cost"
down_revision: Union[str, None] = "0007_workflow_tables"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.add_column(
"usage_events",
sa.Column("cost_usd", sa.Numeric(precision=12, scale=6), nullable=True),
)
op.add_column(
"usage_events",
sa.Column("pricing_version", sa.Text(), nullable=True),
)
op.create_index(
"ix_usage_events_provider_model_created",
"usage_events",
["provider", "model", "created_at"],
)
def downgrade() -> None:
op.drop_index(
"ix_usage_events_provider_model_created",
table_name="usage_events",
)
op.drop_column("usage_events", "pricing_version")
op.drop_column("usage_events", "cost_usd")