| Crates.io | pgmt |
| lib.rs | pgmt |
| version | 0.4.0 |
| created_at | 2025-11-27 18:11:36.89819+00 |
| updated_at | 2026-01-20 06:55:41.781079+00 |
| description | PostgreSQL migration tool that keeps your schema files as the source of truth |
| homepage | https://pgmt.dev |
| repository | https://github.com/gdpotter/pgmt |
| max_upload_size | |
| id | 1954190 |
| size | 1,395,956 |
Database-first development for PostgreSQL Manage schema like code, deploy through explicit migrations
pgmt is a PostgreSQL migration tool that lets you develop your schema like software code — edit database objects directly, see changes immediately, then generate explicit migrations for production deployment.
Install pgmt:
cargo install pgmt
Initialize your project:
# New project
pgmt init
# From existing database
pgmt init --dev-url postgres://localhost/my_existing_db
Development workflow:
# 1. Edit schema files like code
vim schema/views/user_analytics.sql
vim schema/functions/calculate_score.sql
# 2. Apply immediately to dev database
pgmt apply
# 3. Generate migration when ready
pgmt migrate new "add user analytics"
# 4. Deploy to production
pgmt migrate apply --target-url $PROD_DATABASE_URL
-- require: syntaxCore Objects: Tables, Views, Functions, Triggers, Indexes, Constraints, Custom Types, Sequences, Schemas, Extensions Advanced Features: Grants & Privileges, Row-Level Security, Comments, Complex Constraints, All Index Types, Function Overloading PostgreSQL-Specific: ENUMs, Arrays, JSON/JSONB, Exclusion Constraints, Partial Indexes, Expression Indexes
See the complete feature matrix for details.
pgmt manages database object privileges (GRANT/REVOKE) but not roles themselves — create roles using your preferred tools (SQL, Terraform, etc.), then define grants in schema files.
See the Roles & Permissions Guide.
Near-term: Advanced function features, smart rename detection, materialized views Long-term: Schema visualization, migration templates
See the complete roadmap.
# Quick setup (one-time)
./scripts/test-setup.sh
# Run tests
cargo test
# Test against specific PostgreSQL version
DATABASE_URL=$(./scripts/test-db-url.sh 18) cargo test
# Build from source
SQLX_OFFLINE=true cargo build
See the contributing guide for more details.
MIT License — see LICENSE for details.