Migration DDL: data-loss and rollback hazards per dialect

$0.005 USDC per call · Developer and security · POST /api/v1/migration-reversibility · Id migration-reversibility

Classifies each statement of a PostgreSQL, MySQL or SQLite migration (up to 20000 characters) as reversible, needing a backup, needing the original definition, or irreversible, for agents that write or review schema migrations. Flags DROP TABLE/COLUMN, TRUNCATE, unbounded DELETE/UPDATE, lossy type changes, NOT NULL or constraints that fail on existing rows, table-rewrite and lock hazards, and MySQL's non-transactional DDL, with a mechanical inverse statement where one exists. Tokenizer-level: it does not know the table's row counts or contents, runs nothing, and returns unsupported for statement forms it does not classify.

What you get

A down-migration that cannot restore dropped data is found before production, not during the rollback.

Call it

Send the JSON body below to https://agents.writerslogic.com/api/v1/migration-reversibility. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.

curl -i -X POST https://agents.writerslogic.com/api/v1/migration-reversibility \
  -H 'content-type: application/json' \
  -d '{"dialect":"postgres","sql":"ALTER TABLE users ADD COLUMN nickname text; ALTER TABLE users DROP COLUMN legacy_flag;"}'

Input

FieldTypeRequiredDescription
sqlstring; length 0..20000yesThe migration's statements.
dialectstring; one of "postgres", "mysql", "sqlite"yes

Example request body

{
  "dialect": "postgres",
  "sql": "ALTER TABLE users ADD COLUMN nickname text; ALTER TABLE users DROP COLUMN legacy_flag;"
}

Result

The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.

FieldTypeRequiredDescription
statusstring; one of "pass", "fail", "unknown", "unsupported"nopass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass.
dialectstringno
transactionalDdlbooleannoWhether a failed migration rolls back as a unit (false for MySQL).
statementsarray<object>no
witnessesarray<object>no
versionsobjectnoEvery semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile).
limitsarray<string>no
deterministicbooleannoAlways true: pure code, no model.

Pay and connect

Available through: x402 (USDC on Base), MCP. MCP clients reach it through the code-preflight-kit package.

Machine-readable