new mcp servers format
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
"""allow_null_model_and_api_key
|
||||
|
||||
Revision ID: 4a61703e9b7e
|
||||
Revises: 9d819594ac9b
|
||||
Create Date: 2025-04-28 12:04:33.607371
|
||||
|
||||
"""
|
||||
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 = '4a61703e9b7e'
|
||||
down_revision: Union[str, None] = '9d819594ac9b'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('events')
|
||||
op.drop_table('user_states')
|
||||
op.drop_table('app_states')
|
||||
op.drop_table('sessions')
|
||||
op.alter_column('agents', 'model',
|
||||
existing_type=sa.VARCHAR(),
|
||||
nullable=True)
|
||||
op.alter_column('agents', 'api_key',
|
||||
existing_type=sa.VARCHAR(),
|
||||
nullable=True)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('agents', 'api_key',
|
||||
existing_type=sa.VARCHAR(),
|
||||
nullable=False)
|
||||
op.alter_column('agents', 'model',
|
||||
existing_type=sa.VARCHAR(),
|
||||
nullable=False)
|
||||
op.create_table('sessions',
|
||||
sa.Column('app_name', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('user_id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('state', postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=False),
|
||||
sa.Column('create_time', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||||
sa.Column('update_time', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('app_name', 'user_id', 'id', name='sessions_pkey'),
|
||||
postgresql_ignore_search_path=False
|
||||
)
|
||||
op.create_table('app_states',
|
||||
sa.Column('app_name', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('state', postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=False),
|
||||
sa.Column('update_time', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('app_name', name='app_states_pkey')
|
||||
)
|
||||
op.create_table('user_states',
|
||||
sa.Column('app_name', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('user_id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('state', postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=False),
|
||||
sa.Column('update_time', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('app_name', 'user_id', name='user_states_pkey')
|
||||
)
|
||||
op.create_table('events',
|
||||
sa.Column('id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('app_name', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('user_id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('session_id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('invocation_id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('author', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('branch', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('timestamp', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||||
sa.Column('content', postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=True),
|
||||
sa.Column('actions', postgresql.BYTEA(), autoincrement=False, nullable=False),
|
||||
sa.Column('long_running_tool_ids_json', sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column('grounding_metadata', postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=True),
|
||||
sa.Column('partial', sa.BOOLEAN(), autoincrement=False, nullable=True),
|
||||
sa.Column('turn_complete', sa.BOOLEAN(), autoincrement=False, nullable=True),
|
||||
sa.Column('error_code', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('error_message', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('interrupted', sa.BOOLEAN(), autoincrement=False, nullable=True),
|
||||
sa.ForeignKeyConstraint(['app_name', 'user_id', 'session_id'], ['sessions.app_name', 'sessions.user_id', 'sessions.id'], name='events_app_name_user_id_session_id_fkey', ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id', 'app_name', 'user_id', 'session_id', name='events_pkey')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
91
migrations/versions/9d819594ac9b_init_migration.py
Normal file
91
migrations/versions/9d819594ac9b_init_migration.py
Normal file
@@ -0,0 +1,91 @@
|
||||
"""init migration
|
||||
|
||||
Revision ID: 9d819594ac9b
|
||||
Revises:
|
||||
Create Date: 2025-04-28 11:53:49.375964
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '9d819594ac9b'
|
||||
down_revision: Union[str, None] = None
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('clients',
|
||||
sa.Column('id', sa.UUID(), nullable=False),
|
||||
sa.Column('name', sa.String(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('mcp_servers',
|
||||
sa.Column('id', sa.UUID(), nullable=False),
|
||||
sa.Column('name', sa.String(), nullable=False),
|
||||
sa.Column('description', sa.Text(), nullable=True),
|
||||
sa.Column('config_json', sa.JSON(), nullable=False),
|
||||
sa.Column('environments', sa.JSON(), nullable=False),
|
||||
sa.Column('type', sa.String(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
|
||||
sa.CheckConstraint("type IN ('official', 'community')", name='check_mcp_server_type'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('tools',
|
||||
sa.Column('id', sa.UUID(), nullable=False),
|
||||
sa.Column('name', sa.String(), nullable=False),
|
||||
sa.Column('description', sa.Text(), nullable=True),
|
||||
sa.Column('config_json', sa.JSON(), nullable=False),
|
||||
sa.Column('environments', sa.JSON(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('agents',
|
||||
sa.Column('id', sa.UUID(), nullable=False),
|
||||
sa.Column('client_id', sa.UUID(), nullable=True),
|
||||
sa.Column('name', sa.String(), nullable=False),
|
||||
sa.Column('description', sa.Text(), nullable=True),
|
||||
sa.Column('type', sa.String(), nullable=False),
|
||||
sa.Column('model', sa.String(), nullable=False),
|
||||
sa.Column('api_key', sa.String(), nullable=False),
|
||||
sa.Column('instruction', sa.Text(), nullable=True),
|
||||
sa.Column('config', sa.JSON(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
|
||||
sa.CheckConstraint("type IN ('llm', 'sequential', 'parallel', 'loop')", name='check_agent_type'),
|
||||
sa.ForeignKeyConstraint(['client_id'], ['clients.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('contacts',
|
||||
sa.Column('id', sa.UUID(), nullable=False),
|
||||
sa.Column('client_id', sa.UUID(), nullable=True),
|
||||
sa.Column('ext_id', sa.String(), nullable=True),
|
||||
sa.Column('name', sa.String(), nullable=True),
|
||||
sa.Column('meta', sa.JSON(), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
|
||||
sa.ForeignKeyConstraint(['client_id'], ['clients.id'], ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('contacts')
|
||||
op.drop_table('agents')
|
||||
op.drop_table('tools')
|
||||
op.drop_table('mcp_servers')
|
||||
op.drop_table('clients')
|
||||
# ### end Alembic commands ###
|
||||
78
migrations/versions/da8e7fb4da5d_fix_agent_table.py
Normal file
78
migrations/versions/da8e7fb4da5d_fix_agent_table.py
Normal file
@@ -0,0 +1,78 @@
|
||||
"""fix_agent_table
|
||||
|
||||
Revision ID: da8e7fb4da5d
|
||||
Revises: 4a61703e9b7e
|
||||
Create Date: 2025-04-28 12:29:31.292844
|
||||
|
||||
"""
|
||||
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 = 'da8e7fb4da5d'
|
||||
down_revision: Union[str, None] = '4a61703e9b7e'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('user_states')
|
||||
op.drop_table('app_states')
|
||||
op.drop_table('events')
|
||||
op.drop_table('sessions')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('sessions',
|
||||
sa.Column('app_name', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('user_id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('state', postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=False),
|
||||
sa.Column('create_time', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||||
sa.Column('update_time', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('app_name', 'user_id', 'id', name='sessions_pkey'),
|
||||
postgresql_ignore_search_path=False
|
||||
)
|
||||
op.create_table('events',
|
||||
sa.Column('id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('app_name', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('user_id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('session_id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('invocation_id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('author', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('branch', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('timestamp', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||||
sa.Column('content', postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=True),
|
||||
sa.Column('actions', postgresql.BYTEA(), autoincrement=False, nullable=False),
|
||||
sa.Column('long_running_tool_ids_json', sa.TEXT(), autoincrement=False, nullable=True),
|
||||
sa.Column('grounding_metadata', postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=True),
|
||||
sa.Column('partial', sa.BOOLEAN(), autoincrement=False, nullable=True),
|
||||
sa.Column('turn_complete', sa.BOOLEAN(), autoincrement=False, nullable=True),
|
||||
sa.Column('error_code', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('error_message', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('interrupted', sa.BOOLEAN(), autoincrement=False, nullable=True),
|
||||
sa.ForeignKeyConstraint(['app_name', 'user_id', 'session_id'], ['sessions.app_name', 'sessions.user_id', 'sessions.id'], name='events_app_name_user_id_session_id_fkey', ondelete='CASCADE'),
|
||||
sa.PrimaryKeyConstraint('id', 'app_name', 'user_id', 'session_id', name='events_pkey')
|
||||
)
|
||||
op.create_table('app_states',
|
||||
sa.Column('app_name', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('state', postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=False),
|
||||
sa.Column('update_time', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('app_name', name='app_states_pkey')
|
||||
)
|
||||
op.create_table('user_states',
|
||||
sa.Column('app_name', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('user_id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('state', postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=False),
|
||||
sa.Column('update_time', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('app_name', 'user_id', name='user_states_pkey')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user