feat(migration-safety): risk-classify a schema migration#459
Closed
seonghobae wants to merge 1 commit into
Closed
Conversation
analyze_migration_safety(base, target) labels every change safe/warning/destructive with a plain reason: drop table/column & PK change = data loss; type change / SET NOT NULL / new FK = table lock or fail-against-real-data; add nullable / drop FK = safe. Summary flags has_destructive/has_blocking; report sorts dangerous-first. Endpoint GET /api/snapshots/{uuid}/migration-safety?against=... (IDOR-safe). Pure, reuses diff indexing. Targets the #1 fear in migrations. +5 tests, backend suite 263.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AxU2xaupAjp912oDNFuWyd
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on
adhesive-piper(PR #440). Delivers the Migration safety review item already listed under P0 indocs/valuation-gap-analysis.md.Why
Teams don't fear writing a migration — they fear running it in prod: data loss, long table locks, or a migration that fails against real data. This turns a diff into a risk report.
GET /api/snapshots/{uuid}/migration-safety?against=…classifies every change:SET NOT NULL/ new FK (rewrites, full-table scan, or validation that can fail on real data); newNOT NULLcolumnEach item has a plain-language
detail; the summary flagshas_destructive/has_blocking; the report sorts dangerous-first. Pure/dialect-agnostic, name-matched (reuses the diff indexer), IDOR-safe endpoint.Verification
backend
pytest263 passed (+5 per-category classifications + sort order); mypy clean.🤖 Generated with Claude Code