Coverage for mindsdb / migrations / versions / 2024-02-12_9461892bd889_llm_log.py: 82%

11 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-01-21 00:36 +0000

1"""llm_log 

2 

3Revision ID: 9461892bd889 

4Revises: 5a5c49313e52 

5Create Date: 2024-02-12 19:25:32.302526 

6 

7""" 

8from alembic import op 

9import sqlalchemy as sa 

10import mindsdb.interfaces.storage.db # noqa 

11 

12 

13# revision identifiers, used by Alembic. 

14revision = '9461892bd889' 

15down_revision = '5a5c49313e52' 

16branch_labels = None 

17depends_on = None 

18 

19 

20def upgrade(): 

21 # ### commands auto generated by Alembic - please adjust! ### 

22 op.create_table( 

23 'llm_log', 

24 sa.Column('id', sa.Integer(), nullable=False), 

25 sa.Column('company_id', sa.Integer(), nullable=True), 

26 sa.Column('api_key', sa.String(), nullable=True), 

27 sa.Column('model_id', sa.Integer(), nullable=False), 

28 sa.Column('input', sa.String(), nullable=True), 

29 sa.Column('output', sa.String(), nullable=True), 

30 sa.Column('start_time', sa.DateTime(), nullable=False), 

31 sa.Column('end_time', sa.DateTime(), nullable=True), 

32 sa.Column('prompt_tokens', sa.Integer(), nullable=True), 

33 sa.Column('completion_tokens', sa.Integer(), nullable=True), 

34 sa.Column('total_tokens', sa.Integer(), nullable=True), 

35 sa.Column('success', sa.Boolean(), nullable=False), 

36 sa.PrimaryKeyConstraint('id') 

37 ) 

38 # ### end Alembic commands ### 

39 

40 

41def downgrade(): 

42 # ### commands auto generated by Alembic - please adjust! ### 

43 op.drop_table('llm_log') 

44 # ### end Alembic commands ###