"""LLM Metrics Added

Revision ID: 25588210dab2
Revises: 083ccd8206ea
Create Date: 2024-09-17 12:44:12.242990

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = '25588210dab2'
down_revision = '083ccd8206ea'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('llm_usage_metric',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('tenant_id', sa.Integer(), nullable=False),
    sa.Column('environment', sa.String(length=20), nullable=False),
    sa.Column('activity', sa.String(length=20), nullable=False),
    sa.Column('sub_activity', sa.String(length=20), nullable=False),
    sa.Column('activity_detail', sa.String(length=50), nullable=True),
    sa.Column('session_id', sa.String(length=50), nullable=True),
    sa.Column('interaction_id', sa.Integer(), nullable=True),
    sa.Column('document_version_id', sa.Integer(), nullable=True),
    sa.Column('prompt_tokens', sa.Integer(), nullable=True),
    sa.Column('completion_tokens', sa.Integer(), nullable=True),
    sa.Column('total_tokens', sa.Integer(), nullable=True),
    sa.Column('cost', sa.Float(), nullable=True),
    sa.Column('latency', sa.Float(), nullable=True),
    sa.Column('model_name', sa.String(length=50), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=False),
    sa.Column('additional_info', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    schema='public'
    )

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('llm_usage_metric', schema='public')
    # ### end Alembic commands ###
