Apply the live capsule's migration plan - Spacefast Docs
Apply the live capsule's migration plan
Queues the live capsule’s declared migration plan against the Space’s database and returns the plan with an operation to poll. Use it to retry a plan that did not apply during publish; the plan is pinned to the version live at the time of the call, so a later publish cannot redirect the retry. An empty plan queues nothing and answers queued: false. Requires versions:promote, and only a Zero capsule declares a plan: a worker returns runtime_kind_mismatch and a Space with no database returns db_not_available.
POST /v1/spaces/{spaceId}/db/migrate
Authorization
Authorization Bearer token · header required
Authorization: Bearer <key> with the Space key (sfc_ prefix) of an unclaimed Space. The same key is the fragment of the claim URL and the token in the Space's /__/ <key> sign-in URL.
or
Authorization Bearer token · header required
Authorization: Bearer <token> with an API key (sfa_ prefix), an OAuth access token, a session token, or a Space machine credential (sfm_ prefix).
Path parameters
spaceId string required
Responses
200 Response for status 200
$schema string
Canonical JSON Schema URL for this response body. The server also sends it in the Link: rel="describedby" response header.
data object required
versionIdstring required- Live version whose declared plan this is.
- min length 1
runtimeKindstring requiredschemaHashstring | any requiredoperationsobject[] required- Operations the live capsule declared, in the order they apply. Empty when the schema already matches.
- Array of
objectopstring requiredtablestring required- min length 1 · max length 128 · matches ^[A-Za-z_][A-Za-z0-9_]*
queuedboolean required- Whether an apply was queued. False when the plan has no operations, so nothing was queued and no operation is returned.
operationobject | any required- Background operation still running after this call. Null when all work finished before the response.
idstring requiredkindstring requiredstatusstring required- Allowed:
queuedrunningsucceededfailedcanceled
- Allowed:
resourcesobject[] required- Array of
objecttypestring requiredidstring requiredprogressobjecttotalinteger required- min 0 · max 9007199254740991
completedinteger required- min 0 · max 9007199254740991
failedinteger required- min 0 · max 9007199254740991
diagnosticsobject[]- Array of
objectcodestring required- Stable snake_case code for this diagnostic.
severitystring required- How serious the diagnostic is.
- Allowed:
infowarningerror
messagestring required- What happened, in a sentence a person can act on.
pathstring | any- File or artifact path the diagnostic refers to.
providerstring | any- Upstream system that raised the diagnostic.
detailsobject | any- Machine-readable context keyed by the diagnostic code.
fixstring | any- What to change to clear the diagnostic.
retryableboolean | any- True when repeating the same operation unchanged can clear the diagnostic.
- Array of
- Array of
createdAtstringrequired - matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
finishedAtstring- matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
200default
{
"$schema": "http://example.com",
"data": {
"versionId": "string",
"runtimeKind": "zero",
"schemaHash": "string",
"operations": [
{
"op": "create_table",
"table": "string"
}
],
"queued": true
},
"operation": {
"id": "string",
"kind": "string",
"status": "queued",
"resources": [
{
"type": "string",
"id": "string"
}
],
"progress": {
"total": 9007199254740991,
"completed": 9007199254740991,
"failed": 9007199254740991
},
"diagnostics": [
{
"code": "string",
"severity": "info",
"message": "string",
"path": "string",
"provider": "infra",
"details": {
"property1": null,
"property2": null
},
"fix": "string",
"retryable": true
}
],
"createdAt": "2019-08-24T14:15:22Z",
"finishedAt": "2019-08-24T14:15:22Z"
}
}
{
"$schema": "http://example.com",
"type": "string",
"title": "string",
"status": -9007199254740991,
"detail": "string",
"code": "string",
"pointer": "string",
"details": {
"property1": null,
"property2": null
},
"suggestions": [
"string"
],
"next": [
"string"
],
"requestId": "string"
}