> ## Documentation Index
> Fetch the complete documentation index at: https://www.pgschema.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Declarative schema migration for Postgres

export const AsciinemaPlayer = ({recordingId, title = "Terminal Recording", height}) => <div className="my-8 overflow-hidden rounded-xl shadow-lg">
    <iframe className="w-full border-0" src={`https://asciinema.org/a/${recordingId}/iframe?fit=width&autoplay=0`} title={title} allowFullScreen style={{
  height,
  overflow: 'hidden',
  scrollbarWidth: 'none',
  msOverflowStyle: 'none'
}} />
  </div>;

<img className="block dark:hidden" src="https://mintcdn.com/pgschema/h6wZtWPPwiJ1xvfb/logo/light.png?fit=max&auto=format&n=h6wZtWPPwiJ1xvfb&q=85&s=9d16fd67db64bf270e201e6b0e8e8580" width="1088" height="243" data-path="logo/light.png" />

<img className="hidden dark:block" src="https://mintcdn.com/pgschema/h6wZtWPPwiJ1xvfb/logo/dark.png?fit=max&auto=format&n=h6wZtWPPwiJ1xvfb&q=85&s=67614e652771f5405c24cf07644be4a8" width="1088" height="243" data-path="logo/dark.png" />

## What is pgschema?

`pgschema` is a CLI tool that brings terraform-style declarative schema migration workflow to Postgres:

* **Dump** a Postgres schema in a developer-friendly format with support for all common objects
* **Edit** a schema to the desired state
* **Plan** a schema migration by comparing desired state with current database state
* **Apply** a schema migration with concurrent change detection, transaction-adaptive execution, and lock timeout control

Think of it as Terraform for your Postgres schemas - declare your desired state, generate plan, preview changes, and apply them with confidence.

Watch in action:

<AsciinemaPlayer recordingId="vXHygDMUkGYsF6nmz2h0ONEQC" title="pgschema workflow demo" height="550px" />

## Why pgschema?

Traditional database migration tools often require you to write migrations manually or rely on ORMs that may not support all Postgres features. pgschema takes a different approach:

* **Declarative**: Define your desired schema state in SQL files
* **Schema-based**: Compare at the schema level instead of the database level to reconcile schemas across different tenants
* **Comprehensive**: Support most common Postgres objects under a schema
* **Transparent**: Show exactly what SQL will be executed before applying changes

## Getting Started

<CardGroup cols={2}>
  <Card title="Installation" icon="download" href="/installation">
    Install pgschema using Go or download pre-built binaries
  </Card>

  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Learn the basics with a hands-on tutorial
  </Card>
</CardGroup>
