POST /backend/databases/{database_id}/migrations
Apply SQL migrations
Queue versioned SQL migrations on a database. Use when the schema must change. Before: get_database (needs database read access); the user's yes for a live database. Returns the operation (id, status); then get_database_operation (needs database read access). Scope: database:create. A live database requires confirm: true.
API key (Bearer), on the public API endpoint.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
database_id | path | string · required | Resource id (UUID) returned by the list or create tool. |
Idempotency-Key | header | string · required |
Request body
application/json
| Field | Type | Description |
|---|---|---|
migrations | array<object> · required | Migrations, oldest first; an applied version is skipped. |
confirm | boolean | Required true for a live database: the user said yes. |
Responses
| Status | Description | Body |
|---|---|---|
2XX | Success: the JSON body the route returns (see the description for its fields). | object |
401 | Key missing or invalid | Error |
4XX | Refused: act on detail.code, then follow detail.next_action (404 not_found while the service is not open to the account). | Error |
Examples
curl
curl -X POST "$GALON_API_BASE/backend/databases/<database_id>/migrations" \
-H "Authorization: Bearer $GALON_API_KEY" \
-H "Idempotency-Key: <unique-key>" \
-H "Content-Type: application/json" \
-d '{"migrations": [{"version": "string", "name": "string", "sql": "string"}]}'