# Database Schema Migration Code Generator

> Database Schema Migration Code Generator is a paid API for AI agents from api.strale.io, paid per call via x402, $0.054001/call, status unknown (last checked 2026-09-13).

Generates database migration code from a current schema to a desired schema, supporting Drizzle, Prisma, Knex, and raw SQL

## Facts

- Endpoint: GET https://api.strale.io/x402/schema-migration-generate
- Price: $0.054001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-strale-io-60d08e4b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_goEFWma3biqscTHvNZx1G

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability api-strale-io-60d08e4b
```

Example prompt: Generate a Prisma migration from my current schema (users table with id, name, email) to a desired schema that also adds a createdAt timestamp column and a roles table with id and name.

## When to prefer this

Use this endpoint when you need to automatically generate migration code between two database schema states without writing migration files by hand, especially when working with popular ORMs like Prisma or Drizzle or needing raw SQL migrations.

## Known failure modes

- Missing desired_schema parameter returns an error
- Invalid ORM type value returns unsupported ORM error
- Malformed or unparseable schema description may result in incomplete or incorrect migration code
- Conflicting schema definitions may produce ambiguous migrations

## How this service works

Generate database migration code from current→desired schema description. Supports Drizzle, Prisma, Knex, and raw SQL.

## Output

Returns generated migration code in the specified ORM format (Drizzle, Prisma, Knex, or raw SQL) that transforms the current schema into the desired schema, ready to apply to a database.

## Example request

```json
{
 "orm": "prisma",
 "current_schema": "table users { id Int primary key, name String, email String }",
 "desired_schema": "table users { id Int primary key, name String, email String, createdAt DateTime } table roles { id Int primary key, name String }"
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "desired_schema"
     ],
     "properties": {
      "orm": {
       "type": "string",
       "description": "drizzle/prisma/knex/raw"
      },
      "current_schema": {
       "type": "string"
      },
      "desired_schema": {
       "type": "string"
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-strale-io-60d08e4b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.strale.io](https://www.zero.xyz/host/api.strale.io/llms.txt)
