mvp-ai's picture
download
raw
9.45 kB
id,category,check,description,why_it_matters,severity,tags,last_verified
DB056,Reversibility,Every migration has a rollback path,"Write and test the down/rollback migration alongside the up migration, even if you don't expect to use it","A bad deploy without a rollback path turns a 5-minute fix into an incident — the rollback is insurance you write before you need it, not after","High","rollback|reversibility|migrations",2026-07-03
DB057,Reversibility,No irreversible destructive drops in a single step,"Drop a column/table only after a deprecation window (stop writing to it, confirm nothing reads it, then drop in a later migration) rather than in the same release that stops using it","A column dropped in the same deploy that removes its last usage can't be restored if that release turns out to have a bug depending on it","High","destructive-changes|deprecation|migrations",2026-07-03
DB058,Data Integrity,"NOT NULL columns added with a default or backfill","Adding a NOT NULL column to a table with existing rows requires either a DEFAULT value or a backfill step before the constraint is enforced","Without one of these, the migration fails outright against existing data, or worse, silently breaks existing insert code paths that don't set the new column","Critical","not-null|backfill|schema-change",2026-07-03
DB059,Zero-Downtime,"Column rename done as add+backfill+drop, not in-place","Add the new column, backfill it, update application code to write both, then drop the old column in a later deploy — never rename in place on a live table","An in-place rename breaks any in-flight application code (old pods/instances) still referencing the old column name until they've all redeployed","High","zero-downtime|column-rename|rolling-deploy",2026-07-03
DB060,Zero-Downtime,Large-table backfills run in batches,"Backfilling a new column or migrating data on a large table is done in small batched transactions (e.g. 1,000 rows at a time), not one giant transaction","A single massive transaction locks the table for its full duration, and a failure partway through means starting over instead of resuming from the last completed batch","High","backfill|batching|large-tables",2026-07-03
DB061,Zero-Downtime,New indexes created CONCURRENTLY (Postgres),"Use `CREATE INDEX CONCURRENTLY` for indexes added to tables receiving live writes","A normal `CREATE INDEX` takes a lock that blocks writes to the table for the duration of the index build, which can be minutes on a large table","High","index|concurrently|postgres|locking",2026-07-03
DB062,Zero-Downtime,Foreign keys added as NOT VALID then VALIDATE separately,"On a large existing table, add the foreign key constraint with NOT VALID first (fast, no full-table lock), then run VALIDATE CONSTRAINT as a separate step","Adding a foreign key normally scans and locks the whole table to verify existing rows; splitting it into two steps avoids the long lock on the initial add","Medium","foreign-key|not-valid|postgres|locking",2026-07-03
DB063,Zero-Downtime,In-flight application code tolerates the new schema during rollout,"Plan every migration so that both the old and new versions of the application code can run correctly against the schema mid-deploy (rolling deploys mean both versions run simultaneously for a period)","A migration that only the *new* code can handle correctly will break requests served by old-code instances still running during a rolling deploy","High","rolling-deploy|backward-compatibility|schema-change",2026-07-03
DB064,Process,"Migrations run automatically via CI/CD, not manually","Migrations apply as an automated step in the deploy pipeline (see devops module, Phase 3) rather than a developer running them by hand against production","Manual migration application is error-prone (wrong environment, forgotten step, out-of-order application) and isn't auditable the way a pipeline run is","High","ci-cd|automation|deploy-pipeline",2026-07-03
DB065,Process,Migration files are never edited after being applied anywhere shared,"Once a migration has run against staging or production, treat the file as immutable — make a new migration for any further change, never edit history","Editing an already-applied migration desyncs environments that already ran the old version from ones that will run the edited version, corrupting the migration history's guarantee","Critical","immutability|migration-history|version-control",2026-07-03
DB066,Process,Schema migrations kept separate from data backfill scripts,"Structural changes (add column, add index) live in versioned migration files; one-off data fixes/backfills are separate scripts, not mixed into the same file","Mixing them makes migrations slower to run repeatedly (e.g. in tests, which re-run all migrations) and harder to reason about what a migration actually changes structurally","Medium","migrations|data-backfill|separation-of-concerns",2026-07-03
DB067,Process,Staging mirrors production schema before applying to prod,"Every migration runs successfully against a staging environment with production-representative data volume before it's applied to production","Catches lock-duration issues, constraint violations against real data, and performance problems that a nearly-empty local dev database would never surface","High","staging|testing|production-parity",2026-07-03
DB068,Process,Long-running migrations scheduled during low-traffic windows,"A migration expected to take more than a few seconds (even with CONCURRENTLY/NOT VALID techniques) is scheduled and communicated, not run silently during peak traffic","Even a well-designed migration can have unexpected lock contention under real production load — minimize blast radius by timing it deliberately","Medium","scheduling|low-traffic|change-management",2026-07-03
DB069,Process,Backups verified before any destructive migration,"Confirm a recent, restorable backup exists immediately before running any migration that drops, truncates, or irreversibly transforms data","A migration bug discovered after the fact is only recoverable if a good backup exists — verify this before, not after, something goes wrong","Critical","backups|destructive-changes|disaster-recovery",2026-07-03
DB070,Enums,Native enum value additions checked for compatibility,"Postgres native ENUM types can have values added but not easily removed or reordered in a single transaction in older Postgres versions — confirm your Postgres version's behavior before relying on this","Assuming enum values can be freely added/removed like a lookup table's rows leads to migrations that fail or require workarounds mid-deploy","Medium","enum|postgres|compatibility",2026-07-03
DB071,Security,RLS policies updated in the same migration as the table they protect,"When altering a table's structure in a way that affects what a policy checks, update the RLS policy in the same migration, not a follow-up one","A structural change landing before its corresponding policy update leaves a window where the table's access control doesn't match its actual schema/intent","High","rls|security|migrations",2026-07-03
DB072,Security,Migration rollback tested in a non-production environment,"Before considering a rollback path 'safe,' actually run it against a staging environment with realistic data, don't just assume the down migration works because it was written","An untested rollback migration is a false sense of safety — it may fail, or worse, silently corrupt data differently than expected","High","rollback|testing|staging",2026-07-03
DB073,Locking,Composite/multi-column ALTER statements reviewed for lock behavior,"Multiple ALTER TABLE operations combined in one statement can escalate lock requirements — review what lock level Postgres actually takes for the combined operation, not just each part individually","Some combinations of otherwise-safe individual ALTERs require a stronger lock when combined into a single statement than either would alone","Medium","alter-table|locking|postgres",2026-07-03
DB074,Tooling — Supabase,"Migrations committed to supabase/migrations/, applied via CLI","Manage schema changes as versioned SQL files in `supabase/migrations/`, applied with `supabase db push` / the Supabase MCP `apply_migration` tool — never hand-edit schema directly in the dashboard for anything meant to be reproducible","Dashboard-only changes aren't captured in version control, can't be code-reviewed, and won't be replayed when spinning up a new environment or branch","High","supabase|migrations|cli|version-control",2026-07-03
DB075,Tooling — Supabase,Seed data kept separate from schema migrations,"Reference/seed data (e.g. default categories, plan tiers) lives in a `seed.sql` file, not embedded inside structural migration files","Keeps migrations focused on structure, and lets seed data be re-run independently (e.g. to reset a dev/staging environment) without re-running structural changes","Low","supabase|seed-data|separation-of-concerns",2026-07-03
DB076,Review,Migration reviewed by a second person before applying to production,"Treat a migration PR with the same review rigor as application code — a second set of eyes on lock behavior, rollback correctness, and data-integrity impact","Migrations are uniquely hard to fully undo once applied to a shared environment with real data — the cost of a missed issue is higher than in most code review","Medium","code-review|migrations|process",2026-07-03

Xet Storage Details

Size:
9.45 kB
·
Xet hash:
71b9e56fe2a254aedb2590b15bc5dea303bc857507a06a5a159ca54087a81412

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.