From 056411f47dfe8eefa7a74630c63fe2bcb34ea867 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 19 Dec 2025 18:21:54 +0800 Subject: [PATCH] [add] migration script --- .../versions/70e94dd4a8d1_202512191820.py | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 api/migrations/versions/70e94dd4a8d1_202512191820.py diff --git a/api/migrations/versions/70e94dd4a8d1_202512191820.py b/api/migrations/versions/70e94dd4a8d1_202512191820.py new file mode 100644 index 00000000..114340a5 --- /dev/null +++ b/api/migrations/versions/70e94dd4a8d1_202512191820.py @@ -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 ###