feat: add index for workflow_conversation_variables.conversation_id
This commit adds an index to the conversation_id column in the workflow_conversation_variables table to improve query performance when filtering by conversation ID. This is particularly important for API endpoints that retrieve conversation variables for a specific conversation. The index is created via a new migration file and will help optimize database queries as the application scales with more conversations and variables. Signed-off-by: -LAN- <laipz8200@outlook.com>pull/19657/head
parent
2c5f5b0c67
commit
b1acd1b520
@ -0,0 +1,33 @@
|
|||||||
|
"""add index for workflow_conversation_variables.conversation_id
|
||||||
|
|
||||||
|
Revision ID: d28f2004b072
|
||||||
|
Revises: 6a9f914f656c
|
||||||
|
Create Date: 2025-05-14 14:03:36.713828
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import models as models
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'd28f2004b072'
|
||||||
|
down_revision = '6a9f914f656c'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('workflow_conversation_variables', schema=None) as batch_op:
|
||||||
|
batch_op.create_index(batch_op.f('workflow_conversation_variables_conversation_id_idx'), ['conversation_id'], unique=False)
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('workflow_conversation_variables', schema=None) as batch_op:
|
||||||
|
batch_op.drop_index(batch_op.f('workflow_conversation_variables_conversation_id_idx'))
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
Loading…
Reference in New Issue