[modify] migrations script
This commit is contained in:
@@ -34,7 +34,7 @@ class MultiAgentConfig(Base):
|
|||||||
master_agent_id = Column(UUID(as_uuid=True), ForeignKey("app_releases.id"), nullable=True, comment="主 Agent 发布版本 ID")
|
master_agent_id = Column(UUID(as_uuid=True), ForeignKey("app_releases.id"), nullable=True, comment="主 Agent 发布版本 ID")
|
||||||
master_agent_name = Column(String(100), comment="主 Agent 名称")
|
master_agent_name = Column(String(100), comment="主 Agent 名称")
|
||||||
|
|
||||||
default_model_config_id = Column(UUID(as_uuid=True), ForeignKey("model_configs.id"), nullable=False,server_default=str(uuid.UUID(int=0)), index=True, comment="默认模型配置ID")
|
default_model_config_id = Column(UUID(as_uuid=True), ForeignKey("model_configs.id", name="multi_agent_configs_default_model_config_id_fkey"), nullable=True, index=True, comment="默认模型配置ID")
|
||||||
# 结构化配置(直接存储 JSON)
|
# 结构化配置(直接存储 JSON)
|
||||||
model_parameters = Column(JSON, nullable=True, comment="模型参数配置(temperature、max_tokens等)")
|
model_parameters = Column(JSON, nullable=True, comment="模型参数配置(temperature、max_tokens等)")
|
||||||
# 协作模式
|
# 协作模式
|
||||||
|
|||||||
44
api/migrations/versions/a6452760a140_202512261547.py
Normal file
44
api/migrations/versions/a6452760a140_202512261547.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
"""202512261547
|
||||||
|
|
||||||
|
Revision ID: a6452760a140
|
||||||
|
Revises: 5531240c344d
|
||||||
|
Create Date: 2025-12-26 15:57:33.025049
|
||||||
|
|
||||||
|
"""
|
||||||
|
from typing import Sequence, Union
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects import postgresql
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision: str = 'a6452760a140'
|
||||||
|
down_revision: Union[str, None] = '5531240c344d'
|
||||||
|
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('multi_agent_configs', sa.Column('default_model_config_id', sa.UUID(), nullable=True, comment='默认模型配置ID'))
|
||||||
|
op.add_column('multi_agent_configs', sa.Column('model_parameters', postgresql.JSON(astext_type=sa.Text()), nullable=True, comment='模型参数配置(temperature、max_tokens等)'))
|
||||||
|
op.alter_column('multi_agent_configs', 'master_agent_id',
|
||||||
|
existing_type=sa.UUID(),
|
||||||
|
nullable=True,
|
||||||
|
existing_comment='主 Agent 发布版本 ID')
|
||||||
|
op.create_index(op.f('ix_multi_agent_configs_default_model_config_id'), 'multi_agent_configs', ['default_model_config_id'], unique=False)
|
||||||
|
op.create_foreign_key('multi_agent_configs_default_model_config_id_fkey', 'multi_agent_configs', 'model_configs', ['default_model_config_id'], ['id'])
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_constraint('multi_agent_configs_default_model_config_id_fkey', 'multi_agent_configs', type_='foreignkey')
|
||||||
|
op.drop_index(op.f('ix_multi_agent_configs_default_model_config_id'), table_name='multi_agent_configs')
|
||||||
|
op.alter_column('multi_agent_configs', 'master_agent_id',
|
||||||
|
existing_type=sa.UUID(),
|
||||||
|
nullable=False,
|
||||||
|
existing_comment='主 Agent 发布版本 ID')
|
||||||
|
op.drop_column('multi_agent_configs', 'model_parameters')
|
||||||
|
op.drop_column('multi_agent_configs', 'default_model_config_id')
|
||||||
|
# ### end Alembic commands ###
|
||||||
Reference in New Issue
Block a user