0061_commit_graph_global.py
python
sha256:3ff9c9863a9891bdcde71b4a43228f66d0493e38b7cc1d09fe9eb7de774046b2
feat: add repair-commit wire endpoint (API parity with repa…
Opus 4.8
minor
⚠ breaking
1 day ago
| 1 | """Make musehub_commit_graph global — drop repo_id, PK becomes commit_id alone. |
| 2 | |
| 3 | Commits are content-addressed like snapshots; repo_id was the wrong abstraction. |
| 4 | Dropping it also fixes the bug where re-pushed commits (already in musehub_commits) |
| 5 | never got a graph row because the ON CONFLICT key included repo_id. |
| 6 | """ |
| 7 | |
| 8 | from __future__ import annotations |
| 9 | |
| 10 | import sqlalchemy as sa |
| 11 | from alembic import op |
| 12 | |
| 13 | revision = "0061" |
| 14 | down_revision = "0060" |
| 15 | branch_labels = None |
| 16 | depends_on = None |
| 17 | |
| 18 | |
| 19 | def upgrade() -> None: |
| 20 | op.drop_index("ix_musehub_commit_graph_repo_generation", table_name="musehub_commit_graph") |
| 21 | op.drop_constraint("musehub_commit_graph_pkey", "musehub_commit_graph", type_="primary") |
| 22 | op.drop_constraint("musehub_commit_graph_repo_id_fkey", "musehub_commit_graph", type_="foreignkey") |
| 23 | op.drop_column("musehub_commit_graph", "repo_id") |
| 24 | op.create_primary_key("musehub_commit_graph_pkey", "musehub_commit_graph", ["commit_id"]) |
| 25 | op.create_index("ix_musehub_commit_graph_generation", "musehub_commit_graph", ["generation"]) |
| 26 | |
| 27 | |
| 28 | def downgrade() -> None: |
| 29 | op.drop_index("ix_musehub_commit_graph_generation", table_name="musehub_commit_graph") |
| 30 | op.drop_constraint("musehub_commit_graph_pkey", "musehub_commit_graph", type_="primary") |
| 31 | op.add_column( |
| 32 | "musehub_commit_graph", |
| 33 | sa.Column("repo_id", sa.String(128), nullable=False, server_default=""), |
| 34 | ) |
| 35 | op.create_foreign_key( |
| 36 | "musehub_commit_graph_repo_id_fkey", |
| 37 | "musehub_commit_graph", "musehub_repos", |
| 38 | ["repo_id"], ["repo_id"], |
| 39 | ondelete="CASCADE", |
| 40 | ) |
| 41 | op.create_primary_key( |
| 42 | "musehub_commit_graph_pkey", "musehub_commit_graph", ["repo_id", "commit_id"] |
| 43 | ) |
| 44 | op.create_index( |
| 45 | "ix_musehub_commit_graph_repo_generation", |
| 46 | "musehub_commit_graph", |
| 47 | ["repo_id", "generation"], |
| 48 | ) |
File History
1 commit
sha256:3ff9c9863a9891bdcde71b4a43228f66d0493e38b7cc1d09fe9eb7de774046b2
feat: add repair-commit wire endpoint (API parity with repa…
Opus 4.8
minor
⚠
1 day ago