[add] migration script

This commit is contained in:
Mark
2025-12-19 18:21:54 +08:00
committed by 谢俊男
parent 00a5016c06
commit 056411f47d

View File

@@ -0,0 +1,40 @@
"""202512191820
Revision ID: 70e94dd4a8d1
Revises: f96a53af914c
Create Date: 2025-12-19 18:20:21.998247
"""
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 = '70e94dd4a8d1'
down_revision: Union[str, None] = 'f96a53af914c'
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.drop_index(op.f('ix_prompt_model_config_id'), table_name='prompt_model_config')
op.drop_table('prompt_model_config')
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('prompt_model_config',
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
sa.Column('tenant_id', sa.UUID(), autoincrement=False, nullable=False, comment='Tenant ID'),
sa.Column('system_prompt', sa.TEXT(), autoincrement=False, nullable=False, comment='System Prompt'),
sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True, comment='Creation Time'),
sa.Column('updated_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True, comment='Update Time'),
sa.ForeignKeyConstraint(['tenant_id'], ['tenants.id'], name=op.f('prompt_model_config_tenant_id_fkey')),
sa.PrimaryKeyConstraint('id', name=op.f('prompt_model_config_pkey'))
)
op.create_index(op.f('ix_prompt_model_config_id'), 'prompt_model_config', ['id'], unique=False)
# ### end Alembic commands ###