Skip to content

Commit

Permalink
Adds index on message_type
Browse files Browse the repository at this point in the history
  • Loading branch information
markwaddle committed Oct 30, 2024
1 parent 7cf83de commit 2a5b0b1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""index message_type
Revision ID: 039bec8edc33
Revises: b29524775484
Create Date: 2024-10-30 23:15:36.240812
"""

from typing import Sequence, Union

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "039bec8edc33"
down_revision: Union[str, None] = "b29524775484"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.create_index(op.f("ix_conversationmessage_message_type"), "conversationmessage", ["message_type"], unique=False)


def downgrade() -> None:
op.drop_index(op.f("ix_conversationmessage_message_type"), table_name="conversationmessage")
2 changes: 1 addition & 1 deletion workbench-service/semantic_workbench_service/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class ConversationMessage(SQLModel, table=True):
created_datetime: datetime.datetime = date_time_default_to_now()
sender_participant_id: str
sender_participant_role: str
message_type: str
message_type: str = Field(index=True)
content: str
content_type: str
meta_data: dict[str, Any] = Field(sa_column=sqlalchemy.Column("metadata", sqlalchemy.JSON), default={})
Expand Down

0 comments on commit 2a5b0b1

Please sign in to comment.