Databases
Managed Postgres, MySQL, MariaDB, MongoDB, Redis and ClickHouse: reading, creating, configuring, running and credentials.
A managed database is provisioned and versioned the same way an app is, and reachable from apps in the same environment as db-<slug>. Backups are on Backups, the console on Console and logs.
Three recreates, one of them destructive
restartDatabase stops and starts the container. redeployDatabase re-renders the compose from current settings and keeps the data. rebuildDatabase tears down the data volume too and re-provisions an empty instance.
Reading
databases
Any signed-in principal. Returns [Database!].
All databases in the active team, newest first.
| Argument | Type | Description |
|---|---|---|
q | String | Keep only the databases whose name or id contains this, ignoring case and separators. Use search to look across teams. |
query {
databases(q: "shop") {
id
name
type
version
status
host
port
}
}database
Any signed-in principal. Returns Database.
One database by id, or null.
| Argument | Type | Description |
|---|---|---|
id | String! |
query {
database(id: "db_9f1c2ab7d3e4f5a6") {
id
name
type
version
status
host
port
}
}databaseRuntime
Any signed-in principal. Returns AppRuntime.
Live container state for a database, straight from the owning agent. Polled by the database's status badge (same shape as appRuntime).
| Argument | Type | Description |
|---|---|---|
databaseId | String! |
query {
databaseRuntime(databaseId: "db_9f1c2ab7d3e4f5a6") {
running
total
unhealthy
unreachable
}
}Creating and settings
createDatabase
Needs create_databases. Returns Database.
Provision a managed database. username, password and dbName are generated when omitted; environmentId files it into an environment, or omit it for the team's top level.
| Argument | Type | Description |
|---|---|---|
input | CreateDatabaseInput! | |
input.dbName | String | |
input.environmentId | ID | |
input.exposedPort | Int | |
input.exposedPublicly | Boolean | |
input.name | String! | |
input.password | String | |
input.serverId | ID | |
input.type | DatabaseType! | One of clickhouse, mariadb, mongodb, mysql, postgres, redis. |
input.username | String | |
input.version | String! |
mutation {
createDatabase(input: { name: "orders", type: postgres, version: "17" }) {
id
name
type
version
status
host
port
}
}updateDatabase
Needs configure_databases. Returns Database.
Edit a database's public exposure (publish/unpublish + host port) and, optionally, the server it runs on. An in-place edit re-renders the compose and reroutes the container on its current host (data volume preserved). A server change recreates the container on the new host, COPIES its data volume there host-to-host (relayed through the control plane, not via S3) so the data follows the move, then tears down the old host's stack. The copy runs with both stacks stopped and rolls back on failure (the DB stays put). The connection string is re-derived. Everything else is create-only. The publish-ports grant is enforced in the data layer when exposure is on.
| Argument | Type | Description |
|---|---|---|
id | String! | |
input | UpdateDatabaseInput! | |
input.exposedPort | Int | |
input.exposedPublicly | Boolean! | |
input.serverId | ID |
mutation {
updateDatabase(
id: "db_9f1c2ab7d3e4f5a6"
input: { exposedPublicly: true, exposedPort: 5432 }
) {
id
name
type
version
status
host
port
}
}updateDatabaseImage
Needs configure_databases. Returns Database.
Save the database's expert overrides: custom image, custom command, and/or engine version (image tag). Applied on the next redeploy. An absent field is left unchanged; an explicit null clears the override.
| Argument | Type | Description |
|---|---|---|
id | String! | |
input | UpdateDatabaseImageInput! | |
input.customCommand | String | |
input.customImage | String | |
input.version | String |
mutation {
updateDatabaseImage(id: "db_9f1c2ab7d3e4f5a6", input: { version: "17.2" }) {
id
name
type
version
status
host
port
}
}updateDatabaseResources
Needs configure_databases. Returns Database.
Save the database's per-container resource limits. Applied on the next redeploy or settings-driven reroute.
| Argument | Type | Description |
|---|---|---|
id | String! | |
limits | ResourceLimitsInput! | |
limits.cpuMilli | Int | |
limits.cpuShares | Int | |
limits.cpuset | String | |
limits.memoryMb | Int | |
limits.memoryReservationMb | Int | |
limits.nofile | Int | |
limits.nproc | Int | |
limits.oomScoreAdj | Int | |
limits.pidsLimit | Int | |
limits.shmSizeMb | Int | |
limits.storageGb | Int | |
limits.swapMb | Int |
mutation {
updateDatabaseResources(
id: "db_9f1c2ab7d3e4f5a6"
limits: { memoryMb: 512, cpuMilli: 500 }
) {
id
name
type
version
status
host
port
}
}setDatabaseMounts
Needs configure_databases. Returns Database.
Replace the database's config files (whole set - an omitted file is removed) and APPLY them: the files are written next to the stack and the container is recreated, unlike the image/command overrides beside them. A path inside the engine's data directory is refused.
| Argument | Type | Description |
|---|---|---|
id | String! | |
mounts | [DatabaseMountInput!]! | |
mounts.content | String! | |
mounts.filePath | String! | |
mounts.mountPath | String! |
mutation {
setDatabaseMounts(
id: "db_9f1c2ab7d3e4f5a6"
mounts: [{ filePath: "postgresql.conf", mountPath: "/etc/postgresql/postgresql.conf", content: "max_connections = 200\n" }]
) {
id
name
type
version
status
host
port
}
}renameDatabase
Needs configure_databases. Returns Database.
Rename a database - its DISPLAY name only. The container's identity (compose project, data volume, DNS name and therefore the connection string) is fixed at creation and is untouched, so nothing restarts. The name must be unique within the team.
| Argument | Type | Description |
|---|---|---|
id | String! | |
name | String! |
mutation {
renameDatabase(id: "db_9f1c2ab7d3e4f5a6", name: "orders") {
id
name
}
}updateDatabaseLogo
Needs configure_databases. Returns Database.
Set the database's display logo (an image data-URI), or clear it with null to fall back to the engine's own brand mark. Cosmetic only.
| Argument | Type | Description |
|---|---|---|
id | String! | |
logo | String |
mutation {
updateDatabaseLogo(id: "db_9f1c2ab7d3e4f5a6") {
id
name
type
version
status
host
port
}
}reorderDatabases
Needs configure_databases. Returns Boolean.
Persist the team-wide order of databases in the Storage grid. Ids are sanitised to the team's own databases; omitted ones are appended. Returns true.
| Argument | Type | Description |
|---|---|---|
databaseIds | [ID!]! |
mutation {
reorderDatabases(databaseIds: [["db_9f1c2ab7d3e4f5a6"]])
}generateAvailableDbPort
Needs create_databases. Returns Int.
Suggest a host port that is currently free on the target server, for the database 'Expose publicly' flow. Requires the publish-ports grant.
| Argument | Type | Description |
|---|---|---|
serverId | ID |
mutation {
generateAvailableDbPort(serverId: "srv_9f1c2ab7d3e4f5a6")
}Running and recreating
setDatabaseRunning
Needs control_databases. Returns Database.
Start (running: true) or stop the database container.
| Argument | Type | Description |
|---|---|---|
id | String! | |
running | Boolean! |
mutation {
setDatabaseRunning(id: "db_9f1c2ab7d3e4f5a6", running: false) {
id
status
}
}restartDatabase
Needs control_databases. Returns Database.
Restart the database container (stop + start) without re-rendering its compose. Use redeployDatabase to apply pending settings.
| Argument | Type | Description |
|---|---|---|
id | String! |
mutation {
restartDatabase(id: "db_9f1c2ab7d3e4f5a6") {
id
name
type
version
status
host
port
}
}redeployDatabase
Needs control_databases. Returns Database.
Re-render the database's compose from its current settings (resource limits, image/command overrides, exposure) and reroute it on its server. The container is recreated only when its config actually changed; the data volume is always preserved.
| Argument | Type | Description |
|---|---|---|
id | String! |
mutation {
redeployDatabase(id: "db_9f1c2ab7d3e4f5a6") {
id
name
type
version
status
host
port
}
}rebuildDatabase
Needs delete_databases. Returns Database.
DESTRUCTIVE factory reset: tear down the database container AND its data volume, then re-provision a fresh, empty stack from the current settings - same engine, version and credentials, so the connection string is unchanged. ALL DATA IS ERASED. Use redeployDatabase for the data-preserving recreate.
| Argument | Type | Description |
|---|---|---|
id | String! |
mutation {
rebuildDatabase(id: "db_9f1c2ab7d3e4f5a6") {
id
name
type
version
status
host
port
}
}setDatabaseRestartLoopGuard
Needs configure_databases. Returns Boolean.
Turn restart loop protection on or off for one database. Applies at once - there is nothing to redeploy.
| Argument | Type | Description |
|---|---|---|
id | String! | |
value | Boolean! |
mutation {
setDatabaseRestartLoopGuard(id: "db_9f1c2ab7d3e4f5a6", value: true)
}deleteDatabase
Needs delete_databases. Returns Boolean.
Delete its stored backups, then stop and destroy the database's container + data volume on its server, then delete it (dependent backup schedules cascade). A backup that cannot be deleted stops it all unless force, which leaves it to the orphan sweep. The teardown must verifiably succeed: if the server can't be reached, or something of the stack survives it, nothing is deleted and the mutation errors, so a live database is never silently forgotten. force deletes the record anyway (for a host that is never coming back) and queues the teardown, which Deplo retries until the host confirms it. Returns true.
| Argument | Type | Description |
|---|---|---|
force | Boolean | |
id | String! |
mutation {
deleteDatabase(id: "db_9f1c2ab7d3e4f5a6")
}Credentials
Both return the connection string as a String, not the entity. rotateDatabasePassword cuts off anything still using the old credentials the moment it succeeds.
revealConnection
Needs reveal_secrets. Returns String.
Reveal the full (unmasked) connection string for a database.
| Argument | Type | Description |
|---|---|---|
id | String! |
mutation {
revealConnection(id: "db_9f1c2ab7d3e4f5a6")
}rotateDatabasePassword
Needs configure_databases. Returns String.
Rotate the database's engine password (auto-generated when none is given) and return the NEW connection string - shown once, like revealConnection. Engines that persist users in the data volume are told first via an exec in the running container; the compose is then re-rendered so env/command/healthcheck agree. Requires the database to be running.
| Argument | Type | Description |
|---|---|---|
id | String! | |
password | String |
mutation {
rotateDatabasePassword(id: "db_9f1c2ab7d3e4f5a6")
}Moving to another team
Needs move_databases in both teams. Ask databaseTransferInfo first: it lists the teams that can take it and what the move removes. See Move to another team.
databaseTransferInfo
Needs move_databases. Returns DatabaseTransferInfo.
What transferring this database to another team would change, and which of the viewer's other teams could take it.
| Argument | Type | Description |
|---|---|---|
id | String! |
query {
databaseTransferInfo(id: "db_9f1c2ab7d3e4f5a6") {
backupCount
cronCount
databaseName
environmentName
}
}transferDatabaseToTeam
Needs move_databases. Returns Boolean.
Hand this database, with its data, to another team the viewer belongs to. It lands at that team's top level and restarts on its network; backup schedules and cron jobs are removed. Returns true.
| Argument | Type | Description |
|---|---|---|
id | String! | |
teamId | String! |
mutation {
transferDatabaseToTeam(id: "db_9f1c2ab7d3e4f5a6", teamId: "team_9f1c2ab7d3e4f5a6")
}Subscription
databaseStatus
Any signed-in principal. Returns Database.
Emits the database whenever its status changes (provisioning -> running, start/stop, redeploy, ...). Fires once immediately with the current snapshot, then on every change; ends when the database is deleted.
| Argument | Type | Description |
|---|---|---|
id | String! |
subscription {
databaseStatus(id: "db_9f1c2ab7d3e4f5a6") {
id
status
}
}See also
Did this page help you?