Database endpoints
Start a schema migration
Start a background migration that changes an existing table's schema.
POST /v1/tenants/{tenant}/migrations
- Describe the schema changeSupply the table and ordered changes.
- Submit the migrationKeep the returned migration ID.
- Follow progress to cutoverPending does not mean the table has switched.
Before you start
Use your database bearer token.
Register the table first. Only one schema migration can be active on a table; keep the returned ID to check its progress.
Path parameters
| Field | Type | Required |
|---|---|---|
tenant | string | Required |
Headers
| Field | Type | Required | Description |
|---|---|---|---|
x-oc-db-user | string | Optional | Acting database user (role, grant and row-policy checks). Send with x-oc-db-key. |
x-oc-db-key | string | Optional | API key of the x-oc-db-user user. |
Request body
application/json
Limits and accepted values
- schema is the table id;
- diff is applied in order.
- A second migration on a table that already has one in flight answers 400.
| Field | Type | Required |
|---|---|---|
diff | object[] | Required |
Fields in diff
| Field | Type | Required |
|---|---|---|
AddColumn | object | Optional |
Fields in AddColumn
| Field | Type | Required |
|---|---|---|
default | any JSON | Optional |
name | string | Required |
ty | string | Required |
| Field | Type | Required |
|---|---|---|
ChangeColumnType | object | Optional |
Fields in ChangeColumnType
| Field | Type | Required |
|---|---|---|
name | string | Required |
new_ty | string | Required |
| Field | Type | Required |
|---|---|---|
ChangeExtractionPath | object | Optional |
Fields in ChangeExtractionPath
| Field | Type | Required |
|---|---|---|
name | string | Required |
new_path | string | Required |
| Field | Type | Required |
|---|---|---|
DropColumn | object | Optional |
Fields in DropColumn
| Field | Type | Required |
|---|---|---|
name | string | Required |
| Field | Type | Required |
|---|---|---|
RenameColumn | object | Optional |
Fields in RenameColumn
| Field | Type | Required |
|---|---|---|
from | string | Required |
to | string | Required |
| Field | Type | Required |
|---|---|---|
SetColumnDefault | object | Optional |
Fields in SetColumnDefault
| Field | Type | Required |
|---|---|---|
default | any JSON | Optional |
name | string | Required |
| Field | Type | Required |
|---|---|---|
SetColumnNullability | object | Optional |
Fields in SetColumnNullability
| Field | Type | Required |
|---|---|---|
name | string | Required |
required | boolean | Required |
| Field | Type | Required |
|---|---|---|
schema | string | Required |
Read the result
Save the returned migration id. Pending means the migration was accepted, not that the table has switched to its new shape. Check progress and perform cutover when ready.
Response statuses
HTTP status reference
| Status | What to do |
|---|---|
| 200 | OK |
| 400 | Correct the request before retrying. |
| 401 | Check the credential and Authorization header. |
| 402 | Check feature access or available credits. |
| 403 | Check tenant access, roles and permissions. |
| 404 | Check the resource ID and API route. |
| 409 | Resolve the conflict before retrying. |
| 413 | Split or reduce the request body. |
| 415 | Send the required Content-Type. |
| 422 | Correct the values or unsupported combination. |
| 429 | Honor Retry-After when present; back off. |
| 500 | Check the outcome before retrying a write. |
| 501 | Check deployment support for this operation. |
| 503 | Honor Retry-After when present; check write outcomes. |