dcloud deploy database bindBind a managed Postgres database (a dedicated app role by default)
mode=app_role creates role app_<slug> and its database (or grants on an existing one); its password is a secret the binding reads at every rollout. mode=master hands the app the master credential. Saving does not restart the app. Pass redeploy: true to roll the live deployment’s own source onto the new configuration (also needs deploy:DeployApp); otherwise the response and GET …/env report pending until someone redeploys.
Synopsis
dcloud deploy database bind id --db-instance-id dbInstanceId [flags]Arguments
<id>Requiredstring
Also accepted as
--id. Constraints: uuid
Flags
--db-instance-idRequiredstring
The managed Postgres database (instance) to bind
Constraints: 3-64 chars
--db-branch-idOptionalstring
A branch of the database (ewbr-…) to connect to instead: the branch's master user and port, no pooler
Constraints: /^ewbr-[0-9a-f]{12}$/
--databaseOptionalstring
Database inside the instance (app_role mode creates it if missing). Default: the app’s slug as a Postgres name; in master mode or for a branch, the instance’s own database
Constraints: /^[a-z_][a-z0-9_]{0,62}$/
--modeOptionalenum
app_role (default): a role of the app’s own, its password kept in Secrets; master: the instance’s master credential
One of:
app_role,master--env-prefixOptionalstring
Put in front of every generated variable name (e.g. CACHE_ gives CACHE_REDIS_URL), so one app can hold several bindings of a kind; default empty
Constraints: max 32 chars, /^([A-Z][A-Z0-9_]*_)?$/
--pooledOptionalboolean (--pooled / --no-pooled)
Connect through the PgBouncer pooler (default true) or straight to Postgres on 5432; ignored for a branch
--redeployOptionalboolean (--redeploy / --no-redeploy)
Also roll the live deployment onto the new configuration; default false
Example
dcloud deploy database bind id --db-instance-id exampleGenerated from the API description, the same one the API checks requests against and the CLI is built from.