dfb3b7f477da_add_tool_index.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. """add-tool-index
  2. Revision ID: dfb3b7f477da
  3. Revises: b24be59fbb04
  4. Create Date: 2024-01-24 02:17:01.631635
  5. """
  6. from alembic import op
  7. # revision identifiers, used by Alembic.
  8. revision = 'dfb3b7f477da'
  9. down_revision = 'b24be59fbb04'
  10. branch_labels = None
  11. depends_on = None
  12. def upgrade():
  13. # ### commands auto generated by Alembic - please adjust! ###
  14. with op.batch_alter_table('tool_api_providers', schema=None) as batch_op:
  15. batch_op.create_unique_constraint('unique_api_tool_provider', ['name', 'tenant_id'])
  16. with op.batch_alter_table('tool_files', schema=None) as batch_op:
  17. batch_op.create_index('tool_file_conversation_id_idx', ['conversation_id'], unique=False)
  18. # ### end Alembic commands ###
  19. def downgrade():
  20. # ### commands auto generated by Alembic - please adjust! ###
  21. with op.batch_alter_table('tool_files', schema=None) as batch_op:
  22. batch_op.drop_index('tool_file_conversation_id_idx')
  23. with op.batch_alter_table('tool_api_providers', schema=None) as batch_op:
  24. batch_op.drop_constraint('unique_api_tool_provider', type_='unique')
  25. # ### end Alembic commands ###