chore: handle migrations

This commit is contained in:
Novice
2025-06-12 10:59:24 +08:00
parent 6f1cc457a4
commit 642693c79b
2 changed files with 8 additions and 48 deletions

View File

@ -1,39 +0,0 @@
"""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 ###

View File

@ -1,8 +1,8 @@
"""add app mcp client and server
"""add mcp server tool and app server
Revision ID: de71f8771550
Revises: 2adcbe1f5dfb
Create Date: 2025-05-29 17:07:40.037945
Revision ID: 9e4b39294dc8
Revises: 4474872b0ee6
Create Date: 2025-06-12 10:58:14.199433
"""
from alembic import op
@ -11,8 +11,8 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'de71f8771550'
down_revision = '2adcbe1f5dfb'
revision = '9e4b39294dc8'
down_revision = '4474872b0ee6'
branch_labels = None
depends_on = None
@ -46,8 +46,8 @@ def upgrade():
sa.Column('created_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP(0)'), nullable=False),
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('CURRENT_TIMESTAMP(0)'), nullable=False),
sa.PrimaryKeyConstraint('id', name='tool_mcp_provider_pkey'),
sa.UniqueConstraint('name', 'tenant_id', name='unique_mcp_tool_provider'),
sa.UniqueConstraint('server_url_hash', name='unique_mcp_tool_provider_server_url_hash')
sa.UniqueConstraint('tenant_id', 'name', name='unique_mcp_provider_name'),
sa.UniqueConstraint('tenant_id', 'server_url_hash', name='unique_mcp_provider_server_url')
)
# ### end Alembic commands ###
@ -57,5 +57,4 @@ def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('tool_mcp_providers')
op.drop_table('app_mcp_servers')
# ### end Alembic commands ###