"""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")
