set_database_size #
On this page
Generated automatically from the published contract sources.
A script calls this action over HTTPS at POST https://tzcloud.dev.turnzero.ai/v1/set_database_size, with a bearer credential and the action's payload as the JSON body. An MCP connection lists this action as the tool tzcloud_set_database_size.
OAuth access tokens and minted tokens, including the turnzero command's computer token, are bearer credentials. The action determines which kinds, scopes and grants it accepts (Sign-in, sessions, and tokens).
Build metadata: Registered in this build. Registration describes the default dispatcher in this build. It does not guarantee that a caller has the required credential or grant, that a tool is listed for that connection, or that the required service is configured.
Contract description #
On owner request, move your app's production database to dedicated or shared. Ask for a missing size. If unanswered, stop and report. Serverless can move. Development stays shared. account_paused gives reset time. 202 asks for browser approval. Decline or expiry changes nothing.
Approval starts copy, switch and redeploy. Production freezes until redeploy or revert succeeds. Production deploys and promotes return database_move_in_flight during the move. Retry after it ends. A dedicated size is charged per UTC day. A move can charge both dedicated sizes for that day. An application pays for each size only once that day. A posted charge stays if the move fails.
read_approval_status shows completed at start. read_status with wait_seconds gives database_move.outcome: null until done or reverted.
More about this action #
The size argument chooses database-shared, database-dedicated-2gb, database-dedicated-4gb or database-dedicated-8gb. Read production's database_size in read_status for its current size before choosing another. The database stays in its cell. Moving between dedicated sizes creates a new server; only production moves, and development stays shared.
A dedicated size requires an estate that serves dedicated databases. An unbilled account may use any dedicated size. A billed account may use only those the operator opens through dedicated-database-sizes; its empty default opens none. To request another size, email support@turnzero.ai. database_size_not_open lists the open dedicated sizes, says none are open, or says the estate serves none. It creates no pending action. The dedicated-size setting does not restrict a move back to shared.
The move freezes production, copies the database and checks the restored table counts. Then it switches the connection and restarts the version serving production. Production is unavailable from the freeze until the restart succeeds or a revert lifts the freeze on the source. Production deploys and promotes are refused database_move_in_flight until the whole move ends, including server creation. Repeat them after it ends. Production gets a new password and host. The connection limit comes from the target's configured quota and may change. A move to a dedicated size changes the port if production used the pooled port. You need not determine which port it uses beforehand. Dedicated-to-dedicated moves and unlimited applications keep the direct port. The restart supplies the new connection settings. Code that reads them needs no change. Tell the owner this before approval and in the completion report.
For a server app outside the Unlimited plan, the move back keeps the direct address initially. A new production deploy uses pooled port 6432, and a promote uses it if the version recorded it. A serverless app gets port 6432 when the move restarts production. Server apps on the Unlimited plan keep direct port 5432. Explain the port change before approval and in the completion report. The restart supplies the new address. Before moving back, check whether your code needs one PostgreSQL session across transactions. Server apps can use APP_DATABASE_DIRECT_URL for that work.
The application, its hostname, environments, role and database identifiers, code, setting identifiers, development database and files stay. A new move removes an earlier move's kept copy first. The approval details show the day share for the requested size at the time of the request. The platform recalculates it when the new server is ready, before production freezes. A posted charge stays if the move fails.
A dedicated database incurs one charge per UTC day. Each daily charge is that day's share of the size's monthly rate. The daily billing run is scheduled for 03:00 UTC. It posts the charge for the UTC day it runs in. Before a move freezes production, the platform posts that day's share for each dedicated size the move takes or leaves. Each application is charged only once for each size on the same UTC day. A repeat for a size already charged that day adds nothing for that size. The platform returns no credit for the size left. An unbilled account's charge, or one before the estate's charging switch, is recorded without drawing from the balance.
A move back to shared posts the dedicated size's share for that UTC day if it has yet to post. Later days have no dedicated charge while production remains shared. The dedicated charge also covers development. At the first daily billing run after a move to dedicated, the application stops counting toward the shared database charge. Shared database charges already made stay on the account.
The 202 answer gives pending_action, whose id identifies the request, and approval_url, the link the owner opens to approve. The request expires 24 hours after it was made, at expires_at. An expired request changes nothing; call set_database_size again for a new link.
Pass request_id to make a repeat safe. While the earlier pending action is requested, approved or executing, the same account and request_id return it again. Once it has ended, that identifier starts a new pending action. A decline or expiry changes nothing.
Read read_approval_status with pending_action.id. When its state is completed, its outcome gives application, size, previous_size, and move with its id, initial phase and started_at, plus detail. That outcome confirms the move started; it does not report the move's completion. Then call read_status with wait_seconds and read production's latest database_move. Its outcome is null while unfinished, then done or reverted; ended_at gives when it ended.
When execution refuses before the move starts, the pending action ends failed; its outcome carries the refusal's error and detail. No move started and nothing was charged. Other execution failures report execution_failed, with a reference in detail. Recovery after an unfinished execution can report interrupted. Read read_status before repeating after either. A later revert of a started move keeps the pending action completed; read_status reports database_move.outcome: reverted.
If approval ends with job_run_in_flight, read the job run before requesting the move again. Wait if it is still starting or running. A run that Cloud began starting can still block the database request if it was cancelled, timed out or ended without a recorded provider execution. The block lasts until more than the run's timeout plus 90 seconds have passed since Cloud began starting it. For a retry estimate, add the job's timeout for that run plus three minutes to requested_at.
Whenever this reference says to ask support, email support@turnzero.ai.
account_paused refuses this act while the account is paused. While the account is paused, the dedicated server and its data stay. The platform posts and writes off the daily charge. Wait until the reset instant in the detail, or ask support for an operator move back to shared. not_found means there is no production database; no_such_application means the id is absent from your account. deploy_in_flight means a production version is in flight; wait for that version to end. database_move_in_flight means a move is unfinished; wait for it to end.
server_unavailable means no shared server in the cell admits the move back. Repeat set_database_size after the operator makes a shared server available. dedicated_capacity means the cell, region or concurrent-move bound is full; ask support for room, or repeat after another move ends. cell_move_in_flight means a cross-cell move is unfinished; wait for it to end.
For balance_short, check that remaining free usage and live credit together exceed the requested size's charge for the days left in the UTC month, today included. The platform checks at the request, when it describes the approval, at execution and when the new server is ready. It skips the check for a size already charged that UTC day. For rates_unread, the platform could not read the rates or charging switch needed to compute the charge. Retry shortly. Each refuses this act before a new move starts. A redeploy check or a charge check for the requested size can stop a started move before production freezes. read_status then gives database_move.outcome: reverted.
HTTP 503 with database_size_unread means the platform could not read the database's size for the move check. Production stays where it is. Retry in a few minutes.
database_too_large_to_move gives the database's bytes and the act's move bound. Ask support for an operator move at an agreed time. invalid_request covers a size outside the four values or a size production already has. A refused request creates no pending action and changes no database.
For a serverless application, dedicated_size_below_workers means the requested size allows fewer role connections than the account can have live function workers in the cell. Report the refusal and ask the owner to choose an available dedicated size whose role limit covers that worker bound. Wait for the owner's choice before requesting another size.
On a dedicated size, serverless functions connect straight to the dedicated server on port 5432 and should use one connection per worker. Tell the owner this before approval and in the completion report.
Access and action metadata #
{
"name": "set_database_size",
"resource": "application",
"tier": "destructive",
"surface": "tzcloud",
"addresses": [
"tzcloud"
],
"product": "cloud",
"summary": "Move your application's production database to a dedicated size or back to the cell's shared server. Returns 202 with a pending action for browser approval. Approval starts the copy, switch and production redeploy. Production is interrupted, and production deploys and promotes are refused `database_move_in_flight` until the whole move ends; repeat them afterward. Development stays shared. A decline or expiry changes nothing. A dedicated size can start a daily charge.",
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"openWorldHint": true
}
}
MCP catalog entry #
{
"name": "set_database_size",
"title": "Change database size",
"tier": "destructive",
"scenario": "API-L0-31",
"summary": "On owner request, move your app's production database to dedicated or shared. Ask for a missing size. If unanswered, stop and report. Serverless can move. Development stays shared. `account_paused` gives reset time. 202 asks for browser approval. Decline or expiry changes nothing.\n\nApproval starts copy, switch and redeploy. Production freezes until redeploy or revert succeeds. Production deploys and promotes return `database_move_in_flight` during the move. Retry after it ends. A dedicated size is charged per UTC day. A move can charge both dedicated sizes for that day. An application pays for each size only once that day. A posted charge stays if the move fails.\n\n`read_approval_status` shows `completed` at start. `read_status` with `wait_seconds` gives `database_move.outcome`: null until `done` or `reverted`.",
"owners": [
"API-L0-31"
]
}
request #
| JSON pointer | Description and constraints |
|---|---|
| "" (root) | Type: object Required fields: ["application","size"] |
| / |
Your account's application id from list_applications; only its production database moves.Type: string |
| / |
The production database size to move to. A dedicated size uses its own server; database-shared moves back to the cell's shared server. Development stays shared.Type: string Allowed values: ["database-shared","database-dedicated-2gb","database-dedicated-4gb","database-dedicated-8gb"] |
| / |
Any string you choose. A repeat from the same account while the earlier pending action is live (requested, approved, or executing) returns it again; once it has ended, it starts a new one. Omitted, every call creates a new one. Type: string |
response #
| JSON pointer | Description and constraints |
|---|---|
| "" (root) | The 202 creation envelope: the pending action and its approval link. Read the pending record with read_approval_status. Approval starts a database move; the successful outcome records its start, not its completion. A decline or expiry changes nothing.Type: object Required fields: ["contract_version","pending_action","approval_url"] |
| / |
Required value: 1 |
| / |
The short reference the platform recorded your call under: ten lowercase hexadecimal characters, the value in the call’s record row. Quote it when you report the call. Type: string Pattern: ^[0-9a-f]{10}$ |
| / |
The pending action requiring a person's browser approval. Its successful outcome describes the database move that started. |
| / |
$ref: #/shapes/pending_action |
| / |
Type: object |
| / |
On successful approval execution, records the move that was started, not its completion. A failed execution carries its refusal instead. Type: ["object","null"] |
| / |
The application id whose production database move started. Type: string |
| / |
The requested production database size. Type: string Allowed values: ["database-shared","database-dedicated-2gb","database-dedicated-4gb","database-dedicated-8gb"] |
| / |
The production database size read before this move started. Type: string Allowed values: ["database-shared","database-dedicated-2gb","database-dedicated-4gb","database-dedicated-8gb"] |
| / |
The move at its start; this is a snapshot, not a progress read. Type: object Required fields: ["id","phase","started_at"] |
| / |
The identifier of the database move that started. Type: string |
| / |
The move's phase when its start was recorded. Type: string |
| / |
The UTC instant the move's first record was created. Type: string Format: date-time |
| / |
Says the database move started and continues after this call; production deploys and promotes are refused database_move_in_flight until the whole move ends.Type: string |
| / |
Open this link in the browser for the person to approve or decline the pending action. Type: string |
| / |
Says a destructive action completes only through browser approval, directs you to give the person the link, and points to read_approval_status for the outcome.Type: string |
Complete payload contract #
{
"request": {
"type": "object",
"required": [
"application",
"size"
],
"properties": {
"application": {
"type": "string",
"description": "Your account's application id from `list_applications`; only its production database moves."
},
"size": {
"type": "string",
"enum": [
"database-shared",
"database-dedicated-2gb",
"database-dedicated-4gb",
"database-dedicated-8gb"
],
"description": "The production database size to move to. A dedicated size uses its own server; `database-shared` moves back to the cell's shared server. Development stays shared."
},
"request_id": {
"type": "string",
"description": "Any string you choose. A repeat from the same account while the earlier pending action is live (requested, approved, or executing) returns it again; once it has ended, it starts a new one. Omitted, every call creates a new one."
}
}
},
"response": {
"type": "object",
"description": "The 202 creation envelope: the pending action and its approval link. Read the pending record with `read_approval_status`. Approval starts a database move; the successful outcome records its start, not its completion. A decline or expiry changes nothing.",
"required": [
"contract_version",
"pending_action",
"approval_url"
],
"properties": {
"contract_version": {
"const": 1
},
"reference": {
"type": "string",
"pattern": "^[0-9a-f]{10}$",
"description": "The short reference the platform recorded your call under: ten lowercase hexadecimal characters, the value in the call’s record row. Quote it when you report the call."
},
"pending_action": {
"allOf": [
{
"$ref": "#/shapes/pending_action"
},
{
"type": "object",
"properties": {
"outcome": {
"type": [
"object",
"null"
],
"description": "On successful approval execution, records the move that was started, not its completion. A failed execution carries its refusal instead.",
"properties": {
"application": {
"type": "string",
"description": "The application id whose production database move started."
},
"size": {
"type": "string",
"enum": [
"database-shared",
"database-dedicated-2gb",
"database-dedicated-4gb",
"database-dedicated-8gb"
],
"description": "The requested production database size."
},
"previous_size": {
"type": "string",
"enum": [
"database-shared",
"database-dedicated-2gb",
"database-dedicated-4gb",
"database-dedicated-8gb"
],
"description": "The production database size read before this move started."
},
"move": {
"type": "object",
"required": [
"id",
"phase",
"started_at"
],
"description": "The move at its start; this is a snapshot, not a progress read.",
"properties": {
"id": {
"type": "string",
"description": "The identifier of the database move that started."
},
"phase": {
"type": "string",
"description": "The move's phase when its start was recorded."
},
"started_at": {
"type": "string",
"format": "date-time",
"description": "The UTC instant the move's first record was created."
}
}
},
"detail": {
"type": "string",
"description": "Says the database move started and continues after this call; production deploys and promotes are refused `database_move_in_flight` until the whole move ends."
}
}
}
}
}
],
"description": "The pending action requiring a person's browser approval. Its successful outcome describes the database move that started."
},
"approval_url": {
"type": "string",
"description": "Open this link in the browser for the person to approve or decline the pending action."
},
"detail": {
"type": "string",
"description": "Says a destructive action completes only through browser approval, directs you to give the person the link, and points to `read_approval_status` for the outcome."
}
}
}
}
Shared contracts #
- Refusals: every refusal, by surface, with its cause and its remedy
- schemas/wire_error.schema.json
- schemas/wire_errors.json
- schemas/action_payloads.json (includes shared shapes)
- management_api_contract.md