35 lines
875 B
Python
35 lines
875 B
Python
"""Add composite index on event_callback for execute_callbacks query
|
|
|
|
Revision ID: 010
|
|
Revises: 009
|
|
Create Date: 2026-06-03
|
|
"""
|
|
|
|
from typing import Sequence
|
|
|
|
from alembic import op
|
|
|
|
revision: str = '010'
|
|
down_revision: str | None = '009'
|
|
branch_labels: str | Sequence[str] | None = None
|
|
depends_on: str | Sequence[str] | None = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# Local PG validation uses an empty dev database, so a regular index keeps
|
|
# startup reliable without depending on autocommit behavior.
|
|
op.create_index(
|
|
'ix_event_callback_conversation_id_status_event_kind',
|
|
'event_callback',
|
|
['conversation_id', 'status', 'event_kind'],
|
|
if_not_exists=True,
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index(
|
|
'ix_event_callback_conversation_id_status_event_kind',
|
|
table_name='event_callback',
|
|
if_exists=True,
|
|
)
|