chore(migrations): add MCP tool config source tracking fields

- Add source_channel column to mcp_tool_configs with 'self_hosted' default
- Add market_id column to track marketplace source reference
- Add market_config_id column to store marketplace configuration reference
- Add mcp_service_id column to identify MCP service instances
- Enable tracking of tool origin and marketplace integration metadata
This commit is contained in:
Ke Sun
2026-03-06 16:52:27 +08:00
parent 08e4ad6a7c
commit 41a0036bf6

View File

@@ -0,0 +1,36 @@
"""202603061644
Revision ID: 1ac07dc7366f
Revises: 6a4641cf192b
Create Date: 2026-03-06 16:51:10.152305
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '1ac07dc7366f'
down_revision: Union[str, None] = '6a4641cf192b'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('mcp_tool_configs', sa.Column('source_channel', sa.String(length=50), server_default=sa.text("'self_hosted'"), nullable=False, comment='来源渠道'))
op.add_column('mcp_tool_configs', sa.Column('market_id', sa.UUID(), nullable=True, comment='渠道市场id'))
op.add_column('mcp_tool_configs', sa.Column('market_config_id', sa.UUID(), nullable=True, comment='渠道市场配置id'))
op.add_column('mcp_tool_configs', sa.Column('mcp_service_id', sa.String(length=255), nullable=True, comment='mcp服务id'))
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('mcp_tool_configs', 'mcp_service_id')
op.drop_column('mcp_tool_configs', 'market_config_id')
op.drop_column('mcp_tool_configs', 'market_id')
op.drop_column('mcp_tool_configs', 'source_channel')
# ### end Alembic commands ###