Built for How PostgreSQL
Developers Actually Work

Stop fighting your migration tool. Start shipping database changes with the confidence and speed of modern software development.

The PostgreSQL Development Problem

Current migration tools weren't built for PostgreSQL's advanced features and complex dependencies.

Dependency Hell Stops Development Cold

Change one function → break three views → spend 2 hours manually fixing dependencies → repeat for every change.

sql The daily PostgreSQL developer nightmare
-- You want to update a function
ALTER FUNCTION calculate_score(user_id INTEGER) 
RETURNS INTEGER AS $$ ... $$;

-- But PostgreSQL says NO:
ERROR: cannot drop function calculate_score(integer)
DETAIL: view user_rankings depends on it
DETAIL: view daily_stats depends on user_rankings
DETAIL: view analytics_summary depends on daily_stats

-- Manual steps required:
-- 1. DROP VIEW analytics_summary;
-- 2. DROP VIEW daily_stats;
-- 3. DROP VIEW user_rankings;
-- 4. Update function
-- 5. Recreate user_rankings
-- 6. Recreate daily_stats
-- 7. Recreate analytics_summary
-- 8. Hope you didn't miss anything...

pgmt Handles Dependencies Automatically

Edit schema files like code. pgmt figures out the dependency chain and applies changes in the correct order.

sql shell The same change with pgmt!
-- Just edit the function in your schema file
-- schema/functions/calculate_score.sql
CREATE OR REPLACE FUNCTION calculate_score(user_id INTEGER)
RETURNS INTEGER AS $$
  -- Your updated logic here
  RETURN (SELECT points * 2 FROM user_activities WHERE id = user_id);
$$ LANGUAGE plpgsql;
# Apply instantly to development
$ pgmt apply
 Dropping view analytics_summary
 Dropping view daily_stats
 Dropping view user_rankings
 Updating function calculate_score
 Recreating view user_rankings
 Recreating view daily_stats
 Recreating view analytics_summary
 Done.

Why Current Tools Fall Short

Generic Database Tools (Flyway, Liquibase)

  • • Treat PostgreSQL like MySQL - miss advanced features
  • • No dependency resolution for views and functions
  • • Migration-first workflow slows development
  • • Production failures from untested complex changes

ORM Migrations (Prisma, ActiveRecord)

  • • Limited to basic table operations
  • • Can't handle PostgreSQL functions, triggers, views
  • • Magic auto-generation hides what's actually happening
  • • Lock you out of PostgreSQL's powerful features

Raw SQL Scripts

  • • Full PostgreSQL power but zero safety net
  • • Manual dependency management (error-prone)
  • • No development workflow - straight to production
  • • Team collaboration nightmares

pgmt: The PostgreSQL-Native Solution

  • • Full PostgreSQL feature support
  • • Automatic smart dependency resolution
  • • Instant development feedback
  • • Explicit production control with review

Development Workflow Comparison

See how pgmt transforms the PostgreSQL development experience from start to finish.

Traditional Way

1
Write Migration SQL
Manual SQL writing, prone to errors
2
Apply to Dev
Wait for migration runner, debug failures
3
Open PR
Reviewers see migration noise, not intent
4
Deploy
Cross fingers, hope nothing breaks
Slow iteration cycles
Write → fail → debug → rollback → repeat

pgmt Way

1
Edit & Apply
Edit schema files + pgmt apply - instant feedback
2
Generate Migration
Only when ready - reviewable, explicit
3
Deploy Safely
Staged deployment, drift detection
Instant iteration
Edit → apply → done

Full PostgreSQL Support

Everything other tools ignore. pgmt handles the full range of PostgreSQL objects.

Tables
Columns, constraints, defaults
Views
Regular and recursive
Functions
plpgsql, overloads
Triggers
Row and statement level
Types
Enums, composites, domains
Grants
Table, schema, function

Production-Ready Migrations

Break complex migrations into retryable sections with individual timeouts and transaction controls.

sql Multi-section migration with different settings per section
-- migrations/V001__user_migration.sql

-- pgmt:section name="schema_changes"
-- pgmt:  mode="transactional"
-- pgmt:  timeout="5s"
ALTER TABLE users ADD COLUMN last_login TIMESTAMPTZ;

-- pgmt:section name="add_index"
-- pgmt:  mode="non-transactional"
-- pgmt:  timeout="5m"
CREATE INDEX CONCURRENTLY idx_users_last_login ON users(last_login);

-- pgmt:section name="backfill_data"
-- pgmt:  mode="transactional"
-- pgmt:  timeout="30s"
UPDATE users SET last_login = created_at WHERE last_login IS NULL;
Retryable
Failed at step 47? Retry just that section.
Flexible Timeouts
Quick DDL vs long data migrations.
Transaction Control
Mix transactional and non-transactional.

Get Started in Minutes

Works with any existing PostgreSQL database. No complex migration required.

From Zero to Schema-as-Code

bash Get started in minutes
# Install pgmt
$ cargo install pgmt

# Initialize in your project
$ pgmt init
 Created schema/ directory
 Created pgmt.yaml configuration

# Start developing - edit schema files, then:
$ pgmt apply
 Schema applied to development database

# When ready for production:
$ pgmt migrate new "add user preferences"
 Generated migration: V20240315__add_user_preferences.sql

The Bottom Line

pgmt is the only tool that gives you PostgreSQL's full power with instant development feedback and production-grade safety .