Files
FabledScribe/alembic/versions/0045_add_note_version_pin_columns.py
bvandeusen 17211c6e82 feat(schema): add note_version.pin_kind and pin_label
Spec: docs/superpowers/specs/2026-05-13-note-version-pinning-design.md

- pin_kind: NULL=rolling, 'auto'=stability-scan, 'manual'=user-declared.
- pin_label: NULL for rolling; auto-generated for 'auto'; user-supplied
  string for 'manual' (may be NULL).

No backfill — every existing row stays rolling. The daily auto-pin scan
will catch up on the first run after deploy.
2026-05-13 13:55:18 -04:00

36 lines
1.0 KiB
Python

"""add pin_kind and pin_label to note_versions
Revision ID: 0045
Revises: 0044
Create Date: 2026-05-13
Two additive columns on note_versions to support tiered retention:
- pin_kind: NULL (rolling autosave), 'auto' (system-declared via stability
scan), 'manual' (user-declared with optional commit-note label).
- pin_label: NULL for rolling. Auto-generated for 'auto'; user-supplied
for 'manual' (may be NULL).
No backfill — every existing row stays rolling. The auto-pin scan
(services/version_pinning_scheduler.py, daily 03:00 UTC) will catch up on
the first scheduled run after deploy.
"""
from alembic import op
import sqlalchemy as sa
revision = "0045"
down_revision = "0044"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_column("note_versions", sa.Column("pin_kind", sa.Text(), nullable=True))
op.add_column("note_versions", sa.Column("pin_label", sa.Text(), nullable=True))
def downgrade() -> None:
op.drop_column("note_versions", "pin_label")
op.drop_column("note_versions", "pin_kind")