[add] migrations script

This commit is contained in:
Mark
2025-12-25 17:51:27 +08:00
parent 31918d5847
commit ac25b6ff11
2 changed files with 36 additions and 2 deletions

View File

@@ -130,8 +130,8 @@ class BuiltinToolConfig(Base):
id = Column(UUID(as_uuid=True), ForeignKey("tool_configs.id"), primary_key=True)
tool_class = Column(String(255), nullable=False) # 工具类名
parameters = Column(JSON, default=dict) # 工具参数配置
is_enabled = Column(Boolean, default=False, nullable=False) # 启用开关
requires_config = Column(Boolean, default=False, nullable=False) # 是否需要配置
is_enabled = Column(Boolean, default=False, server_default='false', nullable=False) # 启用开关
requires_config = Column(Boolean, default=False, server_default='false', nullable=False) # 是否需要配置
# 关联关系
base_config = relationship("ToolConfig", foreign_keys=[id])

View File

@@ -0,0 +1,34 @@
"""202512251740
Revision ID: 5531240c344d
Revises: 23f5ce1346ba
Create Date: 2025-12-25 17:47:06.575569
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '5531240c344d'
down_revision: Union[str, None] = '23f5ce1346ba'
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('builtin_tool_configs', sa.Column('is_enabled', sa.Boolean(), server_default='false', nullable=False))
op.add_column('builtin_tool_configs', sa.Column('requires_config', sa.Boolean(), server_default='false', nullable=False))
op.add_column('tool_configs', sa.Column('icon', sa.String(length=255), nullable=True))
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('tool_configs', 'icon')
op.drop_column('builtin_tool_configs', 'requires_config')
op.drop_column('builtin_tool_configs', 'is_enabled')
# ### end Alembic commands ###