0026_snapshot_directories.py
python
sha256:a10adeeb7a0169cb9900f9806ed7a973047258abb6283724fe55e8eb68ff3f0a
init: musehub initial commit
Human
171 days ago
| 1 | """Add directories column to musehub_snapshots. |
| 2 | |
| 3 | Snapshot IDs are computed as sha256 of sorted manifest entries AND sorted |
| 4 | directory paths (added when directory-rename tracking was introduced in muse). |
| 5 | Without storing and returning directories, cloned repos fail snapshot |
| 6 | content-hash verification for any snapshot with non-empty directories. |
| 7 | |
| 8 | Revision ID: 0026 |
| 9 | Revises: 0025 |
| 10 | """ |
| 11 | |
| 12 | revision = "0026" |
| 13 | down_revision = "0025" |
| 14 | |
| 15 | from alembic import op |
| 16 | import sqlalchemy as sa |
| 17 | from sqlalchemy.dialects.postgresql import JSONB |
| 18 | |
| 19 | |
| 20 | def upgrade() -> None: |
| 21 | op.add_column( |
| 22 | "musehub_snapshots", |
| 23 | sa.Column( |
| 24 | "directories", |
| 25 | JSONB, |
| 26 | nullable=False, |
| 27 | server_default="[]", |
| 28 | ), |
| 29 | ) |
| 30 | |
| 31 | |
| 32 | def downgrade() -> None: |
| 33 | op.drop_column("musehub_snapshots", "directories") |
File History
1 commit
sha256:a10adeeb7a0169cb9900f9806ed7a973047258abb6283724fe55e8eb68ff3f0a
init: musehub initial commit
Human
171 days ago