Ddl Diff Migrate
by code.halowerk.com in Developer tools
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.
https://code.halowerk.com/v1/ddl-diff-migrate- Price
- $0.004
- per call in USDC
- Uptime
- 96.8%
- last 30 days
- Response time
- 121 ms
- 158 ms slowest 5%
- Last check
- Passed
- 2 h ago, next any minute now
Reliability
Status and outage history · Atom feed · Watch with other listings
How to call it
POST https://code.halowerk.com/v1/ddl-diff-migrate
Each call costs $0.004 in USDC on Base, paid with the request over x402.
Run a free test callOne unpaid request, the way an agent sends it. You see the payment challenge it gets back. Nothing is charged.
Example request
From the listing.
POST https://code.halowerk.com/v1/ddl-diff-migrate
content-type: application/json
{
"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);"
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
include_destructive | boolean | No | Default: false. |
lock_timeout | string | No | Default: "5s". |
new_ddl | string | Yes | |
old_ddl | string | Yes | |
pg_version | integer | No | Default: 16. |
renames | array of object | No | Default: []. |
Example response
The provider's example. We can't check it without paying.
Example response, 62 lines
{
"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"
}Call it from code
The curl command shows the payment challenge. The JavaScript and Python versions pay and call, and never pay more than $0.004.
curl: see the payment challenge
# bash or zsh: see the payment challenge. Nothing is charged.
curl -sS -g -i -X POST 'https://code.halowerk.com/v1/ddl-diff-migrate' \
-H 'content-type: application/json' \
--data-raw '{"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);"}'
# x402 v2 sends the challenge base64-encoded in the PAYMENT-REQUIRED header (v1 sends it in the body).
# To read the header:
curl -sS -g -o /dev/null -D - -X POST 'https://code.halowerk.com/v1/ddl-diff-migrate' \
-H 'content-type: application/json' \
--data-raw '{"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);"}' \
| grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decodeJavaScript: pay and call
// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
// Pays at most $0.004 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.004" });
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const pay = wrapFetchWithPayment(fetch, client);
// Not sure it's safe to pay? ToolVet checks it first for $0.005. Pay for that from a separate
// client: this one is capped at $0.004 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fcode.halowerk.com%2Fv1%2Fddl-diff-migrate&method=POST
const res = await pay("https://code.halowerk.com/v1/ddl-diff-migrate", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"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);"
}),
});
console.log(res.status, await res.text());Python: pay and call
# pip install "x402[requests,evm]"
import os
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client
# Pays at most $0.004 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.004"})
register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))
with x402_requests(client) as session:
res = session.post(
"https://code.halowerk.com/v1/ddl-diff-migrate",
json={
"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);",
},
)
print(res.status_code, res.text)Security scan
No findings
We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.
Recent checks
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 2 h ago | Passed | 402 | 149 ms | $0.004 |
| 12 h ago | Passed | 402 | 118 ms | $0.004 |
| 23 h ago | Passed | 402 | 46 ms | $0.004 |
| 33 h ago | Passed | 402 | 158 ms | $0.004 |
| 43 h ago | Passed | 402 | 124 ms | $0.004 |
Show 10 older checks
| 2 days ago | Passed | 402 | 40 ms | $0.004 |
| 3 days ago | Passed | 402 | 137 ms | $0.004 |
| 5 days ago | Timed out | - | - | - |
| 6 days ago | Passed | 402 | 131 ms | $0.004 |
| 6 days ago | Passed | 402 | 115 ms | $0.004 |
| 7 days ago | Passed | 402 | 120 ms | $0.004 |
| 7 days ago | Passed | 402 | 50 ms | $0.004 |
| 8 days ago | Passed | 402 | 170 ms | $0.004 |
| 8 days ago | Passed | 402 | 124 ms | $0.004 |
| 8 days ago | Passed | 402 | 125 ms | $0.004 |