"""Add index on musehub_object_refs(object_id) for fast bulk object lookups. The composite PK (repo_id, object_id) is optimal for queries that filter on both columns. The push path queries object_refs by a large IN list of object_ids (up to ~8000) with a fixed repo_id. The existing PK covers this case, but an additional single-column index on object_id alone helps the planner choose bitmap index scans when the IN list is large and repo_id has high selectivity. Revision ID: 0052 Revises: 0051 """ from __future__ import annotations from alembic import op revision: str = "0052" down_revision: str = "0051" branch_labels = None depends_on = None def upgrade() -> None: op.create_index( "ix_musehub_object_refs_object_id", "musehub_object_refs", ["object_id"], unique=False, ) def downgrade() -> None: op.drop_index("ix_musehub_object_refs_object_id", table_name="musehub_object_refs")