---
title: "An API to Track Database Schema Changes"
description: "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."
url: "https://swe.quest/articles/an-api-to-track-database-schema-changes-48247d0f7925f89f"
canonical: "https://neon.com/blog/api-track-schema-changes"
source: "Neon"
published: "2025-01-09"
difficulty: "medium"
kind: "Announcement"
reading_minutes: 4
tags: ["postgres","schema-migrations","api-design","ci-cd","ai-agents"]
---

# An API to Track Database Schema Changes

A post on [Neon](https://swe.quest/sources/neon.md), published 2025-01-09, 4 min read, Announcement. Original: [https://neon.com/blog/api-track-schema-changes](https://neon.com/blog/api-track-schema-changes)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Schema migrations](https://swe.quest/tags/schema-migrations.md) (Data & databases)
- [API design](https://swe.quest/tags/api-design.md) (Backend & APIs)
- [CI/CD](https://swe.quest/tags/ci-cd.md) (Reliability & operations)
- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)

## Prerequisites

- PostgreSQL schemas ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- database migrations ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))

## Keywords

Neon, compare\_schema, Schema Diff, Replit Agent, Neon branches, GitHub Actions

## Related posts

- [Track Schema Changes Automatically in Your Pull Requests](https://swe.quest/articles/track-schema-changes-automatically-in-your-pull-requests-a44727ec3dcc4112.md): Neon · 2024-11-28 · Medium · 5 min read · Schema migrations, CI/CD, PostgreSQL
  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.
- [Neon Twin: How to deploy a change tested in Neon to prod in RDS](https://swe.quest/articles/neon-twin-how-to-deploy-a-change-tested-in-neon-to-prod-in-rds-09282f8f58bccb12.md): Neon · 2024-08-15 · Medium · 10 min read · Schema migrations, PostgreSQL, CI/CD, Deployment
  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.
- [Behind Modem.dev’s Product Velocity](https://swe.quest/articles/behind-modem-dev-s-product-velocity-485adbdf853a0161.md): Neon · 2026-01-29 · Medium · 4 min read · PostgreSQL, Schema migrations, CI/CD, Developer productivity
  Modem, a startup building an AI agent that centralizes user feedback from Slack, Discord and GitHub, uses Neon Postgres branching as its development workflow.
- [Adopting Neon branching in CI/CD pipelines: a practical story by Shepherd](https://swe.quest/articles/adopting-neon-branching-in-ci-cd-pipelines-a-practical-story-by-shepherd-7c4ee09d2fb5431a.md): Neon · 2024-07-11 · Medium · 5 min read · CI/CD, PostgreSQL, Schema migrations, Testing, Serverless
  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.
- [A database for every preview environment using Neon, GitHub Actions, and Vercel](https://swe.quest/articles/a-database-for-every-preview-environment-using-neon-github-actions-and-vercel-dd5fe24cba2d12b5.md): Neon · 2023-04-14 · Medium · 14 min read · PostgreSQL, CI/CD, Deployment, Schema migrations
  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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
