Overview
Compare two PostgreSQL DDL versions and get an ordered, lock-aware migration script: new tables, columns, type, default and NOT NULL changes, keys, foreign keys, checks and indexes. Parses old and new DDL (CREATE TABLE, CREATE INDEX and pg_dump-style ALTER TABLE ... ADD CONSTRAINT) and diffs tables, columns, constraints and indexes.
Protocol
x402 (POST)
Price
$0.0040
Payment Asset
USD Coin
Payment Network
Base
Category
uncategorized
Provider
code
Indexed
2026-11-20 13:00:15
Health
Status
unknown
Latency (p50)
—
Uptime (30d)
—
Reliability Score
—
Last Checked
Never
Last Healthy
Never
Consecutive Failures
0
Input Schema
{
"body": {
"new_ddl": "CREATE TABLE users (id bigint PRIMARY KEY, email text NOT NULL, name text);\nCREATE INDEX users_email_idx ON users (email);",
"old_ddl": "CREATE TABLE users (id bigint PRIMARY KEY, email text NOT NULL);"
},
"bodyType": "json",
"method": "POST",
"type": "http"
}
Output Schema
{
"example": {
"limitations": [
"Only tables, columns, constraints and indexes are compared; views, functions, triggers, sequences, grants and partitions are not.",
"Data backfills are not generated; steps that need one are marked.",
"Constraint names of unnamed constraints follow PostgreSQL default naming and are reported as assumed."
],
"result": {
"migration_sql": "SET lock_timeout = '5s';\nALTER TABLE users ADD COLUMN IF NOT EXISTS name text;\nCREATE INDEX CONCURRENTLY IF NOT EXISTS users_email_idx ON users (email);\n",
"possible_renames": [],
"skipped_statements": {
"new": 0,
"old": 0
},
"steps": [
{
"applied": true,
"column": "name",
"destructive": false,
"findings": [],
"kind": "add_column",
"lock_mode": "ACCESS EXCLUSIVE",
"notes": [],
"order": 1,
"sql": [
"ALTER TABLE users ADD COLUMN IF NOT EXISTS name text;"
],
"table": "users"
},
{
"applied": true,
"destructive": false,
"findings": [],
"kind": "create_index",
"lock_mode": "SHARE UPDATE EXCLUSIVE",
"name": "users_email_idx",
"notes": [],
"order": 2,
"sql": [
"CREATE INDEX CONCURRENTLY IF NOT EXISTS users_email_idx ON users (email);"
],
"table": "users"
}
],
"summary": {
"columns_added": 1,
"columns_changed": 0,
"columns_dropped": 0,
"columns_renamed": 0,
"constraints_added": 0,
"constraints_dropped": 0,
"indexes_added": 1,
"indexes_dropped": 0,
"tables_added": 0,
"tables_dropped": 0
},
"warnings": [
"Statements with CONCURRENTLY must not run inside a transaction: execute the script without BEGIN/COMMIT (or split it)."
]
},
"service": "ddl-diff-migrate",
"status": "success"
},
"type": "json"
}