Files
video-gen/video-gen-api/alembic/versions/baf54bec4cb5_数据库修改.py
T
2026-06-01 13:09:28 +08:00

40 lines
1.9 KiB
Python

"""数据库修改
Revision ID: baf54bec4cb5
Revises: 6cf2bcc8915f
Create Date: 2026-05-28 13:40:31.609405
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'baf54bec4cb5'
down_revision: Union[str, None] = '6cf2bcc8915f'
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_index(op.f('ix_credit_ratios_gen_type'), 'credit_ratios', ['gen_type'], unique=False)
op.create_index('ix_credit_ratios_gen_type_engine_resolution', 'credit_ratios', ['gen_type', 'model_config_id', 'resolution'], unique=False)
op.create_index('ix_credit_ratios_gen_type_resolution', 'credit_ratios', ['gen_type', 'resolution'], unique=False)
op.create_index(op.f('ix_credit_ratios_model_config_id'), 'credit_ratios', ['model_config_id'], unique=False)
op.create_index(op.f('ix_credit_ratios_resolution'), 'credit_ratios', ['resolution'], unique=False)
op.drop_constraint(op.f('credit_ratios_model_config_id_fkey'), 'credit_ratios', type_='foreignkey')
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_foreign_key(op.f('credit_ratios_model_config_id_fkey'), 'credit_ratios', 'model_configs', ['model_config_id'], ['id'])
op.drop_index(op.f('ix_credit_ratios_resolution'), table_name='credit_ratios')
op.drop_index(op.f('ix_credit_ratios_model_config_id'), table_name='credit_ratios')
op.drop_index('ix_credit_ratios_gen_type_resolution', table_name='credit_ratios')
op.drop_index('ix_credit_ratios_gen_type_engine_resolution', table_name='credit_ratios')
op.drop_index(op.f('ix_credit_ratios_gen_type'), table_name='credit_ratios')
# ### end Alembic commands ###