PostgreSQL Development
That Finally Feels Natural

Edit schema files like code. pgmt handles dependencies automatically. Generate migrations when you're ready.

You've seen this before:

sql The PostgreSQL error that ruins your afternoon
ERROR: cannot drop function calculate_score(integer) because other objects depend on it
DETAIL: view user_rankings depends on function calculate_score(integer)
DETAIL: view daily_stats depends on view user_rankings
DETAIL: view executive_dashboard depends on view daily_stats
HINT: Use DROP ... CASCADE to drop the dependent objects too.

So you manually figure out the dependency chain:

sql The manual fix (every single time)
-- To change ONE function, you have to:
DROP VIEW executive_dashboard;
DROP VIEW daily_stats;
DROP VIEW user_rankings;

-- NOW you can finally update your function
CREATE OR REPLACE FUNCTION calculate_score(...) ...

-- Then recreate everything in the right order
CREATE VIEW user_rankings AS ...
CREATE VIEW daily_stats AS ...
CREATE VIEW executive_dashboard AS ...

-- Hope you didn't miss anything. Hope the order is right.
-- Hope you remember to do this again for the migration file.

With pgmt, just edit the file:

sql Edit your schema file
-- schema/functions/calculate_score.sql

CREATE OR REPLACE FUNCTION calculate_score(
  user_id INTEGER,
  include_bonus BOOLEAN DEFAULT false  -- new parameter
) RETURNS INTEGER AS $$
BEGIN
  RETURN (
    SELECT SUM(points) + CASE WHEN include_bonus THEN bonus ELSE 0 END
    FROM user_activities WHERE user_id = $1
  );
END;
$$ LANGUAGE plpgsql;

Then run:

shell pgmt figures out the dependencies
$ pgmt apply
 Dropping view executive_dashboard
 Dropping view daily_stats
 Dropping view user_rankings
 Updating function calculate_score
 Recreating view user_rankings
 Recreating view daily_stats
 Recreating view executive_dashboard
 Done.

And that's just the start

Full PostgreSQL Support

Triggers, functions, custom types, grants, extensions - everything other tools ignore.

Safe Migrations

Shadow database testing, explicit generation, review before deploy. Never be surprised.

Production Ready

Sectioned migrations with retries, drift detection, flexible timeouts.

Learn more about pgmt →

Ready to try it?

Get started in minutes.

bash Install pgmt
cargo install pgmt