Преглед на файлове

feat: add index for workflow_conversation_variables.conversation_id (#19657)

Signed-off-by: -LAN- <laipz8200@outlook.com>
tags/1.4.0
-LAN- преди 5 месеца
родител
ревизия
5360180a2a
No account linked to committer's email address
променени са 2 файла, в които са добавени 34 реда и са изтрити 1 реда
  1. 33
    0
      api/migrations/versions/2025_05_14_1403-d28f2004b072_add_index_for_workflow_conversation_.py
  2. 1
    1
      api/models/workflow.py

+ 33
- 0
api/migrations/versions/2025_05_14_1403-d28f2004b072_add_index_for_workflow_conversation_.py Целия файл

@@ -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 ###

+ 1
- 1
api/models/workflow.py Целия файл

@@ -770,7 +770,7 @@ class ConversationVariable(Base):
__tablename__ = "workflow_conversation_variables"

id: Mapped[str] = mapped_column(StringUUID, primary_key=True)
conversation_id: Mapped[str] = mapped_column(StringUUID, nullable=False, primary_key=True)
conversation_id: Mapped[str] = mapped_column(StringUUID, nullable=False, primary_key=True, index=True)
app_id: Mapped[str] = mapped_column(StringUUID, nullable=False, index=True)
data = mapped_column(db.Text, nullable=False)
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp(), index=True)

Loading…
Отказ
Запис