Skip to main content
Databases are exposed by the Databases interface embedded in rest.Rest. They are available on Standard, Pro and Enterprise plans.

Creating a database

api.CreateDatabase(opts) provisions a new database from a squarecloud.DatabaseCreateOptions.
Password (and Certificate, when applicable) appear only in the creation response and cannot be recovered later — store them now. ConnectionURL comes ready to use with the password embedded.
An unsupported type fails with INVALID_DATABASE_TYPE; too little memory for the plan fails with INSUFFICIENT_MEMORY; a failure during provisioning fails with DATABASE_CREATION_FAILED.

Listing your databases

api.GetDatabases() lists every database you own as compact squarecloud.UserDatabase descriptors:

Fetching a single database

Lifecycle

Status and metrics

The database status and metrics endpoints share the same shapes as the application ones (they are type aliases) — see Managing applications for the field-by-field breakdown.

Summary status for every database

Updating

api.UpdateDatabase(dbID, opts) changes the display name and/or memory allocation. At least one field must be provided.

Credentials

api.GetDatabaseCertificate(dbID) returns the TLS certificate (base64-encoded PEM):
api.ResetDatabaseCredentials(dbID, reset) rotates either the password or the certificate, using the squarecloud.DatabaseReset* constants:
The new password is returned only on the password reset response and displayed a single time — store it immediately.

Snapshots

Database snapshots mirror the application snapshot API — see Snapshots.

Deleting a database

Deleting a database is irreversible. Make sure you have a recent snapshot if you might need to recover the data.