fix: change the constraint
parent
f6f9fb1f6b
commit
fadaa79f56
@ -0,0 +1,39 @@
|
|||||||
|
"""mcp tool server url change type
|
||||||
|
|
||||||
|
Revision ID: 162a22ab34cf
|
||||||
|
Revises: de71f8771550
|
||||||
|
Create Date: 2025-05-30 10:54:44.511650
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import models as models
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '162a22ab34cf'
|
||||||
|
down_revision = 'de71f8771550'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('tool_mcp_providers', schema=None) as batch_op:
|
||||||
|
batch_op.drop_constraint(batch_op.f('unique_mcp_tool_provider'), type_='unique')
|
||||||
|
batch_op.drop_constraint(batch_op.f('unique_mcp_tool_provider_server_url_hash'), type_='unique')
|
||||||
|
batch_op.create_unique_constraint('unique_mcp_provider_name', ['tenant_id', 'name'])
|
||||||
|
batch_op.create_unique_constraint('unique_mcp_provider_server_url', ['tenant_id', 'server_url_hash'])
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('tool_mcp_providers', schema=None) as batch_op:
|
||||||
|
batch_op.drop_constraint('unique_mcp_provider_server_url', type_='unique')
|
||||||
|
batch_op.drop_constraint('unique_mcp_provider_name', type_='unique')
|
||||||
|
batch_op.create_unique_constraint(batch_op.f('unique_mcp_tool_provider_server_url_hash'), ['server_url_hash'])
|
||||||
|
batch_op.create_unique_constraint(batch_op.f('unique_mcp_tool_provider'), ['name', 'tenant_id'])
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
Loading…
Reference in New Issue