[add] migration script
This commit is contained in:
66
api/migrations/versions/75e28690ae87_202602251230.py
Normal file
66
api/migrations/versions/75e28690ae87_202602251230.py
Normal file
@@ -0,0 +1,66 @@
|
||||
"""202602251230
|
||||
|
||||
Revision ID: 75e28690ae87
|
||||
Revises: bab823f7cc82
|
||||
Create Date: 2026-02-25 12:27:36.919237
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '75e28690ae87'
|
||||
down_revision: Union[str, None] = 'bab823f7cc82'
|
||||
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.create_table('mcp_market_configs',
|
||||
sa.Column('id', sa.UUID(), nullable=False),
|
||||
sa.Column('mcp_market_id', sa.UUID(), nullable=False, comment='mcp_markets.id'),
|
||||
sa.Column('token', sa.String(), nullable=True, comment='mcp market token'),
|
||||
sa.Column('status', sa.Integer(), nullable=True, comment='connect status(0: Not connected, 1: connected)'),
|
||||
sa.Column('tenant_id', sa.UUID(), nullable=False, comment='tenant.id'),
|
||||
sa.Column('created_by', sa.UUID(), nullable=False, comment='users.id'),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_mcp_market_configs_id'), 'mcp_market_configs', ['id'], unique=False)
|
||||
op.create_table('mcp_markets',
|
||||
sa.Column('id', sa.UUID(), nullable=False),
|
||||
sa.Column('name', sa.String(), nullable=False, comment='mcp market name'),
|
||||
sa.Column('description', sa.String(), nullable=True, comment='mcp market description'),
|
||||
sa.Column('logo_url', sa.String(), nullable=True, comment='logo url'),
|
||||
sa.Column('mcp_count', sa.Integer(), nullable=True, comment='mcp count'),
|
||||
sa.Column('url', sa.String(), nullable=False, comment='mcp market url'),
|
||||
sa.Column('category', sa.String(), nullable=False, comment='category'),
|
||||
sa.Column('created_by', sa.UUID(), nullable=False, comment='users.id'),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_mcp_markets_category'), 'mcp_markets', ['category'], unique=False)
|
||||
op.create_index(op.f('ix_mcp_markets_description'), 'mcp_markets', ['description'], unique=False)
|
||||
op.create_index(op.f('ix_mcp_markets_id'), 'mcp_markets', ['id'], unique=False)
|
||||
op.create_index(op.f('ix_mcp_markets_logo_url'), 'mcp_markets', ['logo_url'], unique=False)
|
||||
op.create_index(op.f('ix_mcp_markets_name'), 'mcp_markets', ['name'], unique=False)
|
||||
op.create_index(op.f('ix_mcp_markets_url'), 'mcp_markets', ['url'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f('ix_mcp_markets_url'), table_name='mcp_markets')
|
||||
op.drop_index(op.f('ix_mcp_markets_name'), table_name='mcp_markets')
|
||||
op.drop_index(op.f('ix_mcp_markets_logo_url'), table_name='mcp_markets')
|
||||
op.drop_index(op.f('ix_mcp_markets_id'), table_name='mcp_markets')
|
||||
op.drop_index(op.f('ix_mcp_markets_description'), table_name='mcp_markets')
|
||||
op.drop_index(op.f('ix_mcp_markets_category'), table_name='mcp_markets')
|
||||
op.drop_table('mcp_markets')
|
||||
op.drop_index(op.f('ix_mcp_market_configs_id'), table_name='mcp_market_configs')
|
||||
op.drop_table('mcp_market_configs')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user