59 lines
2.5 KiB
Python
59 lines
2.5 KiB
Python
"""empty message
|
|
|
|
Revision ID: e41b99574371
|
|
Revises: 3e4ccabe44c3
|
|
Create Date: 2026-10-12 16:52:21.920854
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = 'e41b99574371'
|
|
down_revision: Union[str, Sequence[str], None] = '3e4ccabe44c3'
|
|
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! ###
|
|
with op.batch_alter_table('messagerecord', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_messagerecord_conversation_id'))
|
|
batch_op.create_index(batch_op.f('ix_messagerecord_task_id'), ['task_id'], unique=False)
|
|
|
|
with op.batch_alter_table('runrecord', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_runrecord_conversation_id'))
|
|
batch_op.create_index(batch_op.f('ix_runrecord_task_id'), ['task_id'], unique=False)
|
|
|
|
with op.batch_alter_table('taskrecord', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_conversationrecord_is_deleted'))
|
|
batch_op.drop_index(batch_op.f('ix_conversationrecord_user_id'))
|
|
batch_op.create_index(batch_op.f('ix_taskrecord_is_deleted'), ['is_deleted'], unique=False)
|
|
batch_op.create_index(batch_op.f('ix_taskrecord_user_id'), ['user_id'], unique=False)
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('taskrecord', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_taskrecord_user_id'))
|
|
batch_op.drop_index(batch_op.f('ix_taskrecord_is_deleted'))
|
|
batch_op.create_index(batch_op.f('ix_conversationrecord_user_id'), ['user_id'], unique=False)
|
|
batch_op.create_index(batch_op.f('ix_conversationrecord_is_deleted'), ['is_deleted'], unique=False)
|
|
|
|
with op.batch_alter_table('runrecord', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_runrecord_task_id'))
|
|
batch_op.create_index(batch_op.f('ix_runrecord_conversation_id'), ['task_id'], unique=False)
|
|
|
|
with op.batch_alter_table('messagerecord', schema=None) as batch_op:
|
|
batch_op.drop_index(batch_op.f('ix_messagerecord_task_id'))
|
|
batch_op.create_index(batch_op.f('ix_messagerecord_conversation_id'), ['task_id'], unique=False)
|
|
|
|
# ### end Alembic commands ###
|