Files
headquarter/apps/api/alembic/versions/398082499c30_add_tool_config_fields.py
T
Fusion 8dd350286e feat: implement tool workshop - comprehensive tool system enhancement
- Add Docker Compose and Dockerfile support for tool definitions
- Implement readiness probes with configurable command, timeout, interval
- Create ConfigFolder model for reusable file collections with project overrides
- Add rich tool config fields: port_override, start_command, working_directory, env vars, volumes
- Build unified Tool Workshop UI at /tool-workshop replacing /tool-configs and /tool-types
- Update instance creation to support dockerfile builds, config folder mounting, readiness probes
- Add 3 database migrations for tool_types, tool_configs, and new config_folders table
- Create docker_build.py and readiness_probe.py services
- Add config_folders API with CRUD and project override endpoints

Quality gates: frontend build passes, Python syntax valid, all phases complete

Addresses tool-workshop OpenSpec change
2026-05-22 19:06:45 +02:00

41 lines
1.5 KiB
Python

"""add_tool_config_fields
Revision ID: 398082499c30
Revises: af8512103d67
Create Date: 2026-05-22 18:38:20.166184
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '398082499c30'
down_revision = 'af8512103d67'
branch_labels = None
depends_on = None
def upgrade() -> None:
# Add new columns to tool_configs
op.add_column('tool_configs', sa.Column('port_override', sa.Integer(), nullable=True))
op.add_column('tool_configs', sa.Column('start_command', sa.Text(), nullable=True))
op.add_column('tool_configs', sa.Column('working_directory', sa.Text(), nullable=True))
op.add_column('tool_configs', sa.Column('environment_variables', postgresql.JSONB(astext_type=sa.Text()), nullable=True, server_default='{}'))
op.add_column('tool_configs', sa.Column('volumes', postgresql.JSONB(astext_type=sa.Text()), nullable=True, server_default='[]'))
# Add CHECK constraint for port range
op.create_check_constraint('chk_port_range', 'tool_configs', sa.text('port_override IS NULL OR (port_override >= 1 AND port_override <= 65535)'))
def downgrade() -> None:
# Drop CHECK constraint
op.drop_constraint('chk_port_range', 'tool_configs', type_='check')
# Drop columns
op.drop_column('tool_configs', 'port_override')
op.drop_column('tool_configs', 'start_command')
op.drop_column('tool_configs', 'working_directory')
op.drop_column('tool_configs', 'environment_variables')
op.drop_column('tool_configs', 'volumes')