deploy.host-database-branches.migrateRun a deployment's migrations on the branch and report what they did
The deployment names its migrate command in its bundle (`"migrate": "ews/migrate.mjs"` in .next/ews-outputs.json). The pool host reads the branch’s tables, columns, indexes, constraints and rows, runs `node <script>` from the deployment in a sandbox like the app’s with DATABASE_URL at the branch (at most 10 minutes), reads them again and answers. Read the result with get: migration.summary says it in one line ("2 columns added, the 42 existing rows stay"), migration.diff in full.
Request syntax
POST /deploy/api/host-database/branches/{branchId}/migrate
{
"deploymentId": "string"
}Path parameters
branchIdRequiredstring
Constraints: uuid
Request body
deploymentIdRequiredstring
The deployment whose migrate command runs on the branch: one of the app’s live deployments, usually the preview of the version to publish
Response
202 with `data`: the branch as get describes it, migration.state running. 400 for a deployment that is not the app’s; 409 while the branch is not ready, a migration is still running on it (asked less than 15 minutes ago), or the deployment is not live on the pool host.
A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.
Fields of data
idAlwaysstring
Branch idappIdAlwaysstring
The app whose database it copiesnameAlwaysstring
Its database (and role) name on the pool hostparentNameAlwaysstring
The database it was copied fromstateAlwaysone of creating, ready, failed, deleting, deleted
creating, then ready or failed; deleting, then deletederrorAlwaysstring, may be null
Why the copy failedbytesAlwaysnumber, may be null
Its size as the pool host last reported itexpiresAtAlwaysstring
When it is deleted (ISO 8601)createdAtAlwaysstring
When it was cutreadyAtAlwaysstring, may be null
When the copy was donedeletedAtAlwaysstring, may be null
When it was deletedmigrationAlwaysobject, may be null
The last migrate run on the branch; null before the firstmigration.stateAlwaysone of running, done, failed
running until the pool host answers; done: exit code 0; failed otherwisemigration.deploymentIdAlwaysstring, may be null
The deployment whose migrate command ranmigration.requestedAtAlwaysstring, may be null
When it was asked formigration.exitCodeAlwaysnumber, may be null
Its exit code; -1 when stopped after 10 minutes; null when it could not runmigration.summaryAlwaysstring, may be null
What it did, in one line: "2 columns added, the 42 existing rows stay"migration.diffAlwaysobject, may be null
The shape before and after, compared; null when it could not runmigration.diff.summaryAlwaysstring
The same linemigration.diff.tablesAddedAlwaysarray of string
schema.tablemigration.diff.tablesDroppedAlwaysarray of string
schema.tablemigration.diff.columnsAddedAlwaysarray of string
schema.table.column and its typemigration.diff.columnsDroppedAlwaysarray of string
schema.table.columnmigration.diff.columnsChangedAlwaysarray of string
schema.table.column: before → aftermigration.diff.indexesAddedAlwaysarray of string
Index definitionsmigration.diff.indexesDroppedAlwaysarray of string
Index definitionsmigration.diff.constraintsAddedAlwaysarray of string
table: name and definitionmigration.diff.constraintsDroppedAlwaysarray of string
table: name and definitionmigration.diff.rowsChangedAlwaysarray of string
table: rows before → aftermigration.diff.rowsBeforeAlwaysnumber
Rows in the tables that stayed, beforemigration.diff.rowsAfterAlwaysnumber
Rows in those tables, aftermigration.logTailAlwaysstring, may be null
The last 64 KiB of its outputmigration.errorAlwaysstring, may be null
Why it could not runmigration.finishedAtAlwaysstring, may be null
When the pool host answered
Checked against the handlers: every route test validates their answers against this schema.
Errors
- 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
- 401No credentials, or an access key that is unknown, revoked or expired.
- 403The caller's policies do not allow deploy:ManageHostDatabase on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
- 404The resource does not exist in your organization.
Examples
The required parameters only, with example values. Replace id and the other placeholders with your own.
dcloud deploy host-database-branches migrate branchId --deployment-id examplecurl -X POST "https://console.platform.deutschecloud.app/deploy/api/host-database/branches/branchId/migrate" \
-H "Authorization: EWS-ACCESS-KEY $ACCESS_KEY" \
-H "Content-Type: application/json" \
-d '{"deploymentId":"example"}'import { DcloudClient } from '@dcloud/sdk';
const client = new DcloudClient();
const result = await client.deploy.hostDatabaseBranches.migrate({ branchId: "branchId", deploymentId: "00000000-0000-0000-0000-000000000000" });from dcloud import Client
client = Client()
result = client.deploy.host_database_branches.migrate(branch_id="branchId", deployment_id="00000000-0000-0000-0000-000000000000")Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_deploy_host-database-branches_migrate.