Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Neon 5 min read Announcement mediumAdept

Track Schema Changes Automatically in Your Pull Requests

Neon's Schema Diff GitHub Action compares the schema of a pull request's Neon child branch against its parent (or a specified base_branch) and posts the result as an SQL patch in a single PR comment. The comment is edited in place on new commits, and nothing is posted when the schemas match. A sample workflow creates a per-PR Neon branch with create-branch-action, runs migrations against it, posts the diff, and deletes the branch when the PR closes. The action also outputs a comment_url for further automation, such as Slack notifications.

Related posts

  • An API to Track Database Schema Changes

    Neon mediumAdept

    Neon's Schema Diff feature now has a `compare_schema` API endpoint, available on all plans, that takes two Neon branch IDs and returns a unified diff of their Postgres schemas. The goal is to let AI agents such as Replit Agent and CI/CD pipelines check schema differences programmatically. Optional LSN or timestamp parameters pin a branch to a point in time, but the two are mutually exclusive. The suggested workflow is to apply schema changes on a branch holding a copy of production data, use the API to track discrepancies, then run the migration in production once it has been tested.

  • Neon Twin: How to deploy a change tested in Neon to prod in RDS

    Neon mediumAdept

    Schema changes tested on Neon database branches can be promoted to an AWS RDS production Postgres database through GitHub Actions that run when a pull request merges. Neon's schema diff shows how a dev branch differs from main. From there, migrations are applied in one of two ways: hand-written dated .sql files that a workflow detects via git diff and runs with psql, or Prisma migrations applied with `prisma migrate deploy`. A follow-up pg_dump/pg_restore job then re-syncs the Neon Twin from production.

  • A database for every preview environment using Neon, GitHub Actions, and Vercel

    Neon mediumAdept

    Neon's copy-on-write branching can give every pull request its own production-like Postgres database, avoiding the bottlenecks of shared staging or shared preview databases. Branches are isolated, are created in about a second regardless of database size, and bill only for unique data. A GitHub Actions pipeline creates a Neon branch per PR, runs Prisma migrations against it, deploys a Vercel preview wired to that branch, and comments the URLs on the PR. Merging applies migrations to the primary branch, deploys to production and deletes the preview branch.

  • Adopting Neon branching in CI/CD pipelines: a practical story by Shepherd

    Neon mediumAdept

    Shepherd, an insurtech startup that moved its Alchemist pricing engine from SQLite to Postgres, uses Neon's copy-on-write database branches to give every pull request an ephemeral test database. GitHub Actions call the Neon API to create a branch when a PR opens and delete it on merge. Changes then flow from per-developer and per-PR branches to staging and production, with Render pre-deploy commands applying migrations tracked in a dedicated timestamped table. The team credits branching with removing the cost and effort of keeping test instances synced with production, and notes that scale-to-zero means it no longer pays for idle databases.

  • Branching Postgres databases with the Neon API

    Neon mediumAdept

    Neon branches are copy-on-write clones of a Postgres database that can be created and deleted through the Neon API, giving CI pipelines an isolated copy of production data for end-to-end tests. Two experimental GitHub Actions, neondatabase/create-branch-action and neondatabase/delete-branch-action, wrap the API. A sample pull-request workflow creates a branch from a parent branch, runs the test steps, then deletes the branch. The actions were beta at the time and still being hardened for production use.

The quest for software engineering knowledge.

Look:
Layout: