Coverage for mindsdb / migrations / versions / 2023-09-18_f16d4ab03091_add_agent_id.py: 57%

14 statements  

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

1"""add_agent_id 

2 

3Revision ID: f16d4ab03091 

4Revises: e187961e844a 

5Create Date: 2023-09-18 10:49:36.290319 

6 

7""" 

8from alembic import op 

9import sqlalchemy as sa 

10 

11 

12# revision identifiers, used by Alembic. 

13revision = 'f16d4ab03091' 

14down_revision = 'e187961e844a' 

15branch_labels = None 

16depends_on = None 

17 

18 

19def upgrade(): 

20 with op.batch_alter_table('chat_bots') as batch_op: 

21 batch_op.add_column(sa.Column('agent_id', sa.Integer())) 

22 batch_op.create_foreign_key('fk_agent_id', 'agents', ['agent_id'], ['id']) 

23 

24 

25def downgrade(): 

26 with op.batch_alter_table('chat_bots') as batch_op: 

27 batch_op.drop_constraint('fk_agent_id', type_='foreignkey') 

28 batch_op.drop_column('agent_id')