0033_symbol_intel_blast_index.py
python
sha256:969ddc5e88776e70af33c016b8777bb721356508ae5f304b3fb46c451494ece7
test(mwp3): Phase 4 — fix adjacent suite regressions, lock …
Sonnet 4.6
22 days ago
| 1 | """Add (repo_id, blast DESC) index on musehub_symbol_intel for blast-leader card query. |
| 2 | |
| 3 | The DISTINCT ON (repo_id) ORDER BY repo_id, blast DESC query used by |
| 4 | enrich_repo_cards() needs this index to avoid a sequential scan when |
| 5 | fetching the top blast symbol per repo across a batch of repo IDs. |
| 6 | |
| 7 | Revision ID: 0033 |
| 8 | Revises: 0032 |
| 9 | """ |
| 10 | from __future__ import annotations |
| 11 | |
| 12 | from alembic import op |
| 13 | import sqlalchemy as sa |
| 14 | |
| 15 | revision = "0033" |
| 16 | down_revision = "0032" |
| 17 | branch_labels = None |
| 18 | depends_on = None |
| 19 | |
| 20 | |
| 21 | def upgrade() -> None: |
| 22 | op.create_index( |
| 23 | "ix_symbol_intel_repo_blast", |
| 24 | "musehub_symbol_intel", |
| 25 | ["repo_id", sa.text("blast DESC NULLS LAST")], |
| 26 | if_not_exists=True, |
| 27 | ) |
| 28 | |
| 29 | |
| 30 | def downgrade() -> None: |
| 31 | op.drop_index("ix_symbol_intel_repo_blast", table_name="musehub_symbol_intel") |
File History
2 commits
sha256:969ddc5e88776e70af33c016b8777bb721356508ae5f304b3fb46c451494ece7
test(mwp3): Phase 4 — fix adjacent suite regressions, lock …
Sonnet 4.6
22 days ago
sha256:1749b9cc5cd2583c56d3261c4c00a342c27435f3946d4bc3e70f76aa2795458a
docs(mwp-3): TDD implementation plan for job-enqueue idempo…
Opus 4.8
22 days ago