{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/thinair-co/json-schema/thinair-co-migrations-generate-request-schema.json",
  "title": "MigrationsGenerateRequest",
  "description": "Generate a SQL migration script (up + down + warnings) from a free-text intent. Costs 1 quota unit. Build tier (or higher) required.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/data-thinair-co-openapi.json#/components/schemas/MigrationsGenerateRequest",
  "type": "object",
  "properties": {
    "connection": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256,
      "description": "Connection name (display) or id (uuid). When omitted, the tenant's default (first added) connection is used. Same fallback as the MCP `generate_migration` tool."
    },
    "intent": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000,
      "description": "Plain-English description of the migration. Examples: 'add soft delete to drivers', 'add index on trips(driver_id, created_at)', 'rename email to email_address on drivers'. Phrasing matters: name the table, the column, and the action explicitly — the intent parser extracts those three and will reject a request it cannot resolve rather than guess."
    },
    "target_dialect": {
      "type": "string",
      "enum": [
        "postgres",
        "mysql",
        "mssql"
      ],
      "description": "Optional target dialect. The handler currently derives dialect from the resolved connection — this hint is informational only and reserved for future cross-dialect translation. Mismatches between hint and resolved dialect surface in response meta but don't override."
    },
    "dry_run": {
      "type": "boolean",
      "description": "Reserved for future support. The current handler NEVER executes the generated SQL — it only emits up + down strings — so dry_run is effectively always true. Echoed in response meta when set."
    }
  },
  "required": [
    "intent"
  ]
}