Apply a migration
migrations.applyRecord and apply one migration (name + SQL) in a single transaction, then reload the REST API's schema cache. It is linted first: a table without row level security is blocked. dry_run: true only lints. Destructive SQL needs confirm: true and the destructive scope (production:destructive on production). Scope: database:write.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"name": "<name>",
"sql": "<sql>"
},
"name": "migrations.apply"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | The migration's SQL | |
| name | Yes | Short snake_case name, e.g. `create_todos` | |
| branch | No | Branch (environment) id. Optional: defaults to `production`. | |
| confirm | No | Must be true to run a destructive operation, after the user approved it | |
| dry_run | No | Only lint and plan; change nothing | |
| version | No | Version number; default is the current UTC time as YYYYMMDDHHMMSS | |
| project_id | No | Project id. Optional: defaults to the project created or used last in this session, or the only one. | |
| organization_id | No | Organization id. Optional: defaults to the token's organization, or the only one you belong to. |