---
title: Documentation
description: pgmold documentation — PostgreSQL schema-as-code
---

import { Card, CardGrid, LinkCard } from '@astrojs/starlight/components';

pgmold is a PostgreSQL schema-as-code tool. Define schemas in native SQL, diff against live databases, and apply migrations safely.

```bash
# See what would change
pgmold plan -s sql:schema.sql -d postgres://localhost/mydb

# Apply the migration
pgmold apply -s sql:schema.sql -d postgres://localhost/mydb
```

## Get started

<CardGrid>
  <LinkCard title="Installation" href="/docs/getting-started/installation/" description="Install pgmold via Cargo" />
  <LinkCard title="Quick Start" href="/docs/getting-started/quick-start/" description="Up and running in 60 seconds" />
</CardGrid>

## Guides

<CardGrid>
  <LinkCard title="Multi-File Schemas" href="/docs/guides/multi-file-schemas/" description="Organize schema across directories" />
  <LinkCard title="Filtering" href="/docs/guides/filtering/" description="Include/exclude by name or type" />
  <LinkCard title="Adopting pgmold" href="/docs/guides/adopting/" description="Baseline an existing database" />
  <LinkCard title="CI/CD Integration" href="/docs/guides/ci-cd/" description="GitHub Action and drift detection" />
  <LinkCard title="Drizzle ORM" href="/docs/guides/drizzle/" description="Use Drizzle schemas as source" />
  <LinkCard title="Safety Rules" href="/docs/guides/safety/" description="Destructive operation guardrails" />
</CardGrid>

## Reference

<CardGrid>
  <LinkCard title="CLI Commands" href="/docs/reference/cli/" description="All commands and flags" />
  <LinkCard title="Terraform Provider" href="/docs/reference/terraform/" description="Schema management in HCL" />
  <LinkCard title="GitHub Action" href="/docs/reference/github-action/" description="drift-check action reference" />
</CardGrid>
