Skip to content

docs: add migration safety guide with pgfence#654

Open
flvmnt wants to merge 4 commits intodrizzle-team:mainfrom
flvmnt:docs/add-pgfence-migration-safety
Open

docs: add migration safety guide with pgfence#654
flvmnt wants to merge 4 commits intodrizzle-team:mainfrom
flvmnt:docs/add-pgfence-migration-safety

Conversation

@flvmnt
Copy link

@flvmnt flvmnt commented Feb 25, 2026

Summary

  • Adds a new guide: Analyze migration safety with pgfence (src/content/docs/guides/migration-safety-with-pgfence.mdx)
  • Adds navigation entry to _map.json

pgfence (@flvmnt/pgfence on npm) is a Postgres migration safety CLI that analyzes SQL files for dangerous lock patterns. Since drizzle-kit generate produces plain SQL migration files, pgfence can analyze them directly to report lock modes, risk levels, and safe rewrite recipes before migrations reach production.

Guide covers

  • Install instructions using the <Npm> component
  • The generate-analyze-migrate workflow with Drizzle Kit
  • Understanding pgfence output (lock modes, risk levels, safe rewrites)
  • Common dangerous patterns detected (non-concurrent indexes, unsafe ALTER COLUMN, etc.)
  • CI integration with a GitHub Actions workflow example
  • Output format options (CLI table, JSON, GitHub PR markdown)

Why this fits in Drizzle docs

Drizzle Kit generates raw SQL migration files, which makes it a natural fit for static analysis tools. This guide helps Drizzle users catch dangerous DDL patterns (table-level locks, missing CONCURRENTLY, unsafe constraint additions) before deploying, following the same pattern as other ecosystem integration guides.

Add a new guide showing how to analyze Drizzle Kit generated SQL
migrations with pgfence for lock mode detection, risk assessment,
and safe rewrite recipes before deploying to production.
Copilot AI review requested due to automatic review settings February 25, 2026 22:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Drizzle docs guide describing how to use pgfence to analyze generated SQL migrations for potentially dangerous locking patterns, and exposes the guide in the Guides navigation map.

Changes:

  • Added a new MDX guide: “Analyze migration safety with pgfence”.
  • Added the guide entry to src/content/docs/guides/_map.json.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/content/docs/guides/migration-safety-with-pgfence.mdx New ecosystem guide explaining a generate → analyze → migrate workflow and CI integration using pgfence.
src/content/docs/guides/_map.json Adds the new guide to the Guides navigation list.
Comments suppressed due to low confidence (1)

src/content/docs/guides/migration-safety-with-pgfence.mdx:10

  • CodeTabs and CodeTab are imported but never used in this guide. If the docs build/lint checks for unused imports, this can fail CI or add noise. Please remove these imports or add the intended <CodeTabs>/<CodeTab> usage.
import CodeTabs from '@mdx/CodeTabs.astro';
import CodeTab from '@mdx/CodeTab.astro';

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@flvmnt
Copy link
Author

flvmnt commented Feb 25, 2026

Addressed feedback: removed unused CodeTabs/CodeTab imports, pinned pgfence version in all examples, removed hidden Unicode characters.

@flvmnt
Copy link
Author

flvmnt commented Feb 25, 2026

Verified: scanned both files for hidden/bidi Unicode characters (U+200B-U+200F, U+202A-U+202E, U+2066-U+2069, U+FEFF, and all Unicode Cf-category characters) — none found. Previous commit d362d6d already cleaned them. All npx pgfence commands confirmed pinned to @0.2.1 with --yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants