Migration Scripts endpoints

Write, check, approve and analyze scripts before they run. Paths are relative to the address of your Simcha DB Studio server.

Through the MCP server these endpoints are the Migration Scripts tool group, on by default.

While this group is on, the MCP server also offers the lookups its tools need: environments_list (List environments, from Environments and Groupings), connections_devops_list (List DB DevOps connections, from Connections), connections_devops_by_environment (List the DB DevOps connections in an environment, from Connections), connections_devops_databases (List the databases on a connection's server, from Connections).

MethodPathWhat it does
GET/api/db-devops/scriptsList migration scripts
GET/api/db-devops/scripts/:idGet a migration script
POST/api/db-devops/scriptsCreate a migration script
PUT/api/db-devops/scripts/:idChange a migration script
DELETE/api/db-devops/scripts/:idDelete a migration script
POST/api/db-devops/scripts/:id/approveApprove a migration script
POST/api/db-devops/scripts/:id/rejectReject a migration script
POST/api/db-devops/scripts/:id/resubmitResubmit a rejected migration script
GET/api/db-devops/scripts/:id/complianceCheck a script against the compliance rules
GET/api/db-devops/scripts/pipeline-stagesShow the pipeline stages scripts reached
GET/api/db-devops/scripts/:id/blast-radiusGet the blast radius of a script
POST/api/db-devops/scripts/:id/blast-radiusCompute the blast radius of a script
GET/api/db-devops/scripts/:id/blast-radius/narrativeExplain the blast radius of a script
GET/api/db-devops/scripts/:id/rollbackGet the generated rollback of a script
POST/api/db-devops/scripts/:id/rollback/regenerateGenerate the rollback of a script again
POST/api/db-devops/scripts/:id/shadow-runStart a shadow run of a script
GET/api/db-devops/scripts/:id/shadow-runsList the shadow runs of a script
GET/api/db-devops/shadow-runs/:idGet a shadow run
POST/api/db-devops/shadow-runs/:id/abortStop a shadow run
GET/api/db-devops/snapshots/:idGet a decision snapshot
GET/api/db-devops/snapshots/:id/diff/:otherIdCompare two decision snapshots
GET/api/db-devops/consumersList the consumers of a connection
POST/api/db-devops/consumersRegister a consumer of an object
DELETE/api/db-devops/consumers/:idRemove a consumer
GET/api/db-devops/consumers/sampling/:connectionIdShow the usage sampler of a connection
POST/api/db-devops/consumers/sampling/:connectionIdTurn the usage sampler on or off
POST/api/db-devops/consumers/sampling/:connectionId/runSample the consumers of a connection now

GET /api/db-devops/scripts

Lists the scripts the caller can see, newest first, with their SQL, approval status, environment and target. Send page and limit together to get one page.

Reads only · Role: Any signed-in user · MCP tool: scripts_list

InputTypeDescription
page (query)integer, 1 or more, optionalThe page number, starting at 1. Used only with limit
limit (query)integer, 1 or more, optionalScripts per page. Used only with page

GET /api/db-devops/scripts/:id

Returns one script with its SQL, rollback SQL, approval status, revision, environment, target and dependencies.

Reads only · Role: Any signed-in user · MCP tool: scripts_get

InputTypeDescription
id (path)string (uuid), requiredThe script ID

POST /api/db-devops/scripts

Creates a script pending approval, owned by the caller. It has no blast radius report until one is computed with scripts_blast_radius_compute.

Changes data · Role: Any signed-in user · MCP tool: scripts_create

InputTypeDescription
name (body)string, requiredThe script name, up to 500 characters
description (body)string, optionalWhat the script does
version (body)string, optionalA version label, up to 50 characters
sql_content (body)string, requiredThe script text, up to 5 MB. It cannot contain NUL characters; a byte order mark at the start is removed
rollback_sql (body)string, optionalThe statements that undo the script
environment (body)string, requiredThe name of the environment the script is for. It must match an existing environment
execution_mode (body)one of release, asap, optionalrelease (runs only once approved) or asap (can run before approval where the environment does not require approval). Defaults to release when creating
target_connection_id (body)string (uuid) or null, optionalThe connection the script runs on. It must be in the script environment. Send null to clear it
target_database (body)string, optionalThe database on the target connection, up to 255 characters
dependencies (body)list of string (uuid), optionalScripts that need a completed run before this one can run. Each can be listed once; a script cannot depend on itself or form a loop
tags (body)list of string, optionalTags for the script

PUT /api/db-devops/scripts/:id

Changes the fields sent. Changing the SQL or the rollback SQL sets an approved script back to pending approval and every signed-off release holding it back to pending sign-off. Approval fields cannot be changed here.

Changes data · Role: Any signed-in user · MCP tool: scripts_update

InputTypeDescription
id (path)string (uuid), requiredThe script ID
name (body)string, optionalThe script name, up to 500 characters
description (body)string, optionalWhat the script does
version (body)string, optionalA version label, up to 50 characters
sql_content (body)string, optionalThe script text, up to 5 MB. It cannot contain NUL characters; a byte order mark at the start is removed
rollback_sql (body)string, optionalThe statements that undo the script
environment (body)string, optionalThe name of the environment the script is for. It must match an existing environment
execution_mode (body)one of release, asap, optionalrelease (runs only once approved) or asap (can run before approval where the environment does not require approval). Defaults to release when creating
target_connection_id (body)string (uuid) or null, optionalThe connection the script runs on. It must be in the script environment. Send null to clear it
target_database (body)string, optionalThe database on the target connection, up to 255 characters
dependencies (body)list of string (uuid), optionalScripts that need a completed run before this one can run. Each can be listed once; a script cannot depend on itself or form a loop
tags (body)list of string, optionalTags for the script

DELETE /api/db-devops/scripts/:id

Deletes a script. A script used by a release, a run or an approval request cannot be deleted.

Changes data and can remove or overwrite it · Role: Release manager or admin · MCP tool: scripts_delete

InputTypeDescription
id (path)string (uuid), requiredThe script ID

POST /api/db-devops/scripts/:id/approve

Approves a script that is waiting for approval and notifies its author. An approved or rejected script is 409 NOT_PENDING. When self-approval is turned off, the author cannot approve it, and a script that fails a compliance rule of error severity cannot be approved.

Changes data · Role: Approver, release manager or admin · MCP tool: scripts_approve

InputTypeDescription
id (path)string (uuid), requiredThe script ID

POST /api/db-devops/scripts/:id/reject

Rejects a script that is waiting for approval, with an optional reason, and notifies its author. An approved or rejected script is 409 NOT_PENDING. A rejected script can be resubmitted.

Changes data · Role: Approver, release manager or admin · MCP tool: scripts_reject

InputTypeDescription
id (path)string (uuid), requiredThe script ID
reason (body)string, optionalWhy the script is rejected
rejection_reason (body)string, optionalAnother name for reason, read when reason is left out

POST /api/db-devops/scripts/:id/resubmit

Sets a rejected script back to pending approval and clears the rejection. Only a rejected script can be resubmitted.

Changes data · Role: Any signed-in user · MCP tool: scripts_resubmit

InputTypeDescription
id (path)string (uuid), requiredThe script ID

GET /api/db-devops/scripts/:id/compliance

Checks a script against the active compliance rules for its environment and returns each rule result and whether the script passes, which it does when no rule of error severity fails.

Reads only · Role: Any signed-in user · MCP tool: scripts_compliance

InputTypeDescription
id (path)string (uuid), requiredThe script ID

GET /api/db-devops/scripts/pipeline-stages

For each script in a signed-off release that follows a pipeline, returns the furthest stage it reached: the release, pipeline, environment, stage number and number of stages. Keyed by script ID.

Reads only · Role: Any signed-in user · MCP tool: scripts_pipeline_stages

No inputs.

GET /api/db-devops/scripts/:id/blast-radius

Returns the latest blast radius report of a script: the objects that depend on what it touches, the consumers that read them, totals and whether the report is complete, partial or failed. Returns null when none has been computed.

Reads only · Role: Any signed-in user · MCP tool: scripts_blast_radius

InputTypeDescription
id (path)string (uuid), requiredThe script ID

POST /api/db-devops/scripts/:id/blast-radius

Reads the dependency graph of the script target database and stores a new blast radius report, which it returns and which replaces the earlier one. This is the only way a report is made. Refused when the script has no target connection; its earlier reports are then removed.

Changes data · Role: Any signed-in user · MCP tool: scripts_blast_radius_compute

InputTypeDescription
id (path)string (uuid), requiredThe script ID
approvalRequestId (body)string (uuid), optionalThe approval request to link the report to

GET /api/db-devops/scripts/:id/blast-radius/narrative

Describes the latest blast radius report of a script in plain language using the configured AI provider and records the request in the AI run history. Refused when no report exists, AI is not configured, AI agents are turned off or the rate limit is reached.

Changes data · Role: Any signed-in user · MCP tool: scripts_blast_radius_explain

InputTypeDescription
id (path)string (uuid), requiredThe script ID

GET /api/db-devops/scripts/:id/rollback

Returns the rollback generated for a script from its target database: status (ready, generating, failed, unavailable or no_target), the rollback SQL, what cannot be undone, the row changes a run captures just before it starts, and whether the script has a rollback written on it, which a run keeps instead. It is generated automatically and never runs by itself. Reading it starts a new generation when the script or its target has changed.

Reads only · Role: Any signed-in user · MCP tool: scripts_rollback

InputTypeDescription
id (path)string (uuid), requiredThe script ID

POST /api/db-devops/scripts/:id/rollback/regenerate

Reads the catalog of the script target database again and replaces the generated rollback, which it returns. It reads no row values and changes nothing on the target, the script or its approval. Refused when the script has no target connection.

Changes data · Role: Any signed-in user · MCP tool: scripts_rollback_regenerate

InputTypeDescription
id (path)string (uuid), requiredThe script ID

POST /api/db-devops/scripts/:id/shadow-run

Starts a shadow run in the background: a temporary copy of the target database schema is made on the same server, the script runs there, the schema before and after is compared and the copy is dropped, leaving the target unchanged. Returns the run at once; follow it with scripts_shadow_run_get. A script without a target connection gives a failed run.

Changes data · Role: Any signed-in user · MCP tool: scripts_shadow_run

InputTypeDescription
id (path)string (uuid), requiredThe script ID
approvalRequestId (body)string (uuid), optionalThe approval request to link the run to
sample (body)boolean, optionaltrue to also copy a sample of rows from the tables the script touches, when the server allows sampling

GET /api/db-devops/scripts/:id/shadow-runs

Lists the shadow runs of a script with their status, statement results, schema differences and errors.

Reads only · Role: Any signed-in user · MCP tool: scripts_shadow_runs

InputTypeDescription
id (path)string (uuid), requiredThe script ID

GET /api/db-devops/shadow-runs/:id

Returns one shadow run: its status (provisioning, running, succeeded, failed or aborted), pre-flight checks, statement results, schema differences, timing and error.

Reads only · Role: Any signed-in user · MCP tool: scripts_shadow_run_get

InputTypeDescription
id (path)string (uuid), requiredThe shadow run ID

POST /api/db-devops/shadow-runs/:id/abort

Asks a shadow run to stop at its next step before the script runs; the temporary copy is still dropped. A finished run is returned unchanged.

Changes data · Role: Any signed-in user · MCP tool: scripts_shadow_run_abort

InputTypeDescription
id (path)string (uuid), requiredThe shadow run ID

GET /api/db-devops/snapshots/:id

Returns a decision snapshot captured for an approval request: the target schema, statistics, dependency impact and touched objects at that moment, what triggered it and whether the capture is complete. Snapshots hold no row data or credentials.

Reads only · Role: Any signed-in user · MCP tool: scripts_snapshot_get

InputTypeDescription
id (path)string (uuid), requiredThe snapshot ID

GET /api/db-devops/snapshots/:id/diff/:otherId

Compares two decision snapshots of the same connection and returns the objects added, removed or changed from the first to the second. Snapshots of different connections cannot be compared.

Reads only · Role: Any signed-in user · MCP tool: scripts_snapshot_compare

InputTypeDescription
id (path)string (uuid), requiredThe earlier snapshot ID
otherId (path)string (uuid), requiredThe later snapshot ID

GET /api/db-devops/consumers

Lists the consumers recorded for the objects of a connection: services, dashboards, jobs and other readers, either tagged by people or observed by the usage sampler, with when they were last seen. A connectionId that is not a connection id is 400 INVALID_CONNECTION_ID; a connection that does not exist or is not yours to use is 404 CONNECTION_NOT_FOUND.

Reads only · Role: Any signed-in user · MCP tool: scripts_consumers_list

InputTypeDescription
connectionId (query)string (uuid), requiredThe connection ID

POST /api/db-devops/consumers

Registers a tagged consumer of an object on a connection, shown in the blast radius of scripts that touch it. Registering the same consumer again updates when it was last seen. A connectionId that is not a connection id is 400 INVALID_CONNECTION_ID; a connection that does not exist or is not yours to use is 404 CONNECTION_NOT_FOUND.

Changes data · Role: Any signed-in user · MCP tool: scripts_consumers_add

InputTypeDescription
connectionId (body)string (uuid), requiredThe connection that holds the object
objectSchema (body)string, optionalThe schema of the object. Defaults to public
objectName (body)string, requiredThe object name
consumerKind (body)one of service, dashboard, job, other, requiredWhat kind of consumer it is
consumerName (body)string, requiredThe consumer name

DELETE /api/db-devops/consumers/:id

Removes a tagged or observed consumer.

Changes data and can remove or overwrite it · Role: Any signed-in user · MCP tool: scripts_consumers_delete

InputTypeDescription
id (path)string (uuid), requiredThe consumer ID

GET /api/db-devops/consumers/sampling/:connectionId

Shows whether the usage sampler is on for a connection, whether its engine can be sampled and why not, the sampling interval in milliseconds and the days after which an unseen consumer counts as stale.

Reads only · Role: Any signed-in user · MCP tool: scripts_sampler_status

InputTypeDescription
connectionId (path)string (uuid), requiredThe connection ID

POST /api/db-devops/consumers/sampling/:connectionId

Turns the usage sampler on or off for a connection. It cannot be turned on for an engine whose sessions cannot be observed.

Changes data · Role: Any signed-in user · MCP tool: scripts_sampler_set

InputTypeDescription
connectionId (path)string (uuid), requiredThe connection ID
enabled (body)boolean, optionaltrue to turn sampling on; false or left out turns it off

POST /api/db-devops/consumers/sampling/:connectionId/run

Reads the sessions active on the connection now and records the applications seen reading each object as observed consumers. Returns how many consumer records were added or updated. Refused when the engine cannot be observed.

Changes data · Role: Any signed-in user · MCP tool: scripts_sampler_run

InputTypeDescription
connectionId (path)string (uuid), requiredThe connection ID