0016_refactor_events_commit_message.py
file-level
1
files
1
commits
0
hotspots
0
🧊 dead
0
💥 blast risk
| 1 | """detect-refactor: add commit_message column and composite kind index |
| 2 | |
| 3 | ``commit_message`` lets the UI display the commit that introduced each |
| 4 | refactoring event without a separate join or subprocess call. |
| 5 | |
| 6 | The composite index ``ix_intel_refactor_events_repo_kind`` on |
| 7 | ``(repo_id, kind)`` accelerates per-kind filtering used by the |
| 8 | intel/detect-refactor page (implementation / signature / move / rename). |
| 9 | |
| 10 | Revision ID: 0016 |
| 11 | Revises: 0015 |
| 12 | """ |
| 13 | |
| 14 | from alembic import op |
| 15 | import sqlalchemy as sa |
| 16 | |
| 17 | revision = "0016" |
| 18 | down_revision = "0015" |
| 19 | branch_labels = None |
| 20 | depends_on = None |
| 21 | |
| 22 | |
| 23 | def upgrade() -> None: |
| 24 | op.add_column( |
| 25 | "musehub_intel_refactor_events", |
| 26 | sa.Column("commit_message", sa.Text, nullable=True), |
| 27 | ) |
| 28 | op.create_index( |
| 29 | "ix_intel_refactor_events_repo_kind", |
| 30 | "musehub_intel_refactor_events", |
| 31 | ["repo_id", "kind"], |
| 32 | ) |
| 33 | |
| 34 | |
| 35 | def downgrade() -> None: |
| 36 | op.drop_index( |
| 37 | "ix_intel_refactor_events_repo_kind", |
| 38 | table_name="musehub_intel_refactor_events", |
| 39 | ) |
| 40 | op.drop_column("musehub_intel_refactor_events", "commit_message") |