Out Plane
db

db database

The db database commands.

These are the databases inside a managed instance, which is a different level from the instance itself: db list is the instances, and this is what is inside one.

Each has an owner, which is a role. While the instance has exactly one role the owner is filled in; with several, it has to be named, because choosing an owner is choosing who can read the data.

db database list

List the databases inside a managed instance.

read onlyrepeatable

Usage

outplane db database list <DATABASE>

Arguments

ArgumentTypeDescription
DATABASEstringDatabase name or id. Required.

Output

FieldTypeDescription
namestring
ownerstring | nullThe role that owns it.
dbstringThe instance it is inside.

Examples

What is inside an instance

outplane db database list orders

Read the names and owners in a pipeline

outplane db database list orders --json --fields name,owner
{
  "items": [
    {
      "name": "main",
      "owner": "app"
    }
  ],
  "total": 1,
  "truncated": false
}

Check what a role owns before removing it

outplane db database list orders -o text

What to Know

  • Two levels share the word database: the managed instance, and the databases inside it. db list is the first, this is the second.

Errors

Beyond 0 for success, this command exits with:

ExitKindMeaning
2usageInvalid arguments, unknown flag, or client-side validation failure.
3authNot authenticated, token revoked or expired, or forbidden for this team.
5not_foundThe named resource does not exist, or is not visible to this credential.
8upstreamThe Out Plane API returned a server error.

The code on the error object is one of db.not_found, usage.missing_argument. Branch on that, or on the exit status. The message is prose and changes.

db database create

Add a database inside a managed instance.

writes--dry-run

Usage

outplane db database create <DATABASE> <NAME> [flags]

Arguments

ArgumentTypeDescription
DATABASEstringDatabase name or id. Required.
NAMEstringThe database's name. Required.

Flags

FlagTypeDescription
--ownerstringRole that owns it. Optional when the instance has one role.

The global flags apply as well.

Output

FieldTypeDescription
kindstringOne of role, database.
namestring
ownerstring | null
dbstring
dbIdstring
changedbool

Examples

One database per service

outplane db database create orders checkout --owner checkout

Check the request without creating anything

outplane db database create orders checkout --owner checkout --dry-run --json
{
  "changed": false,
  "kind": "database",
  "name": "checkout",
  "owner": "checkout"
}

Create one and read the result

outplane db database create orders checkout --owner checkout --json --fields name,owner,changed

What to Know

  • The owner must already exist. Create the role first when a service should own its own database.
  • With one role the owner is filled in. With several the command refuses and lists them rather than picking one.

Errors

Beyond 0 for success, this command exits with:

ExitKindMeaning
2usageInvalid arguments, unknown flag, or client-side validation failure.
3authNot authenticated, token revoked or expired, or forbidden for this team.
5not_foundThe named resource does not exist, or is not visible to this credential.
8upstreamThe Out Plane API returned a server error.

The code on the error object is one of db.not_found, db.owner_required, usage.missing_argument. Branch on that, or on the exit status. The message is prose and changes.

db database delete

Destroy a database inside an instance.

destructive--dry-run

Usage

outplane db database delete <DATABASE> <NAME> [flags]

Arguments

ArgumentTypeDescription
DATABASEstringDatabase name or id. Required.
NAMEstringThe database's name. Required.

Flags

FlagTypeDescription
-y, --yesboolAcknowledge the deletion. Not sufficient on its own.
--confirm-namestringThe name, typed again.

The global flags apply as well.

Output

FieldTypeDescription
kindstringOne of role, database.
namestring
dbstring
changedbool

Examples

See what would go

outplane db database delete orders old --dry-run

The confirmed form

outplane db database delete orders old --yes --confirm-name old

Read what the name resolves to, before confirming

outplane db database delete orders old --dry-run --json
{
  "changed": false,
  "kind": "database",
  "name": "old"
}

What to Know

  • Never prompts. Without confirmation it exits 4 and returns the command to replay in the error's confirm_command field.
  • Under a detected agent harness it exits 4 even with both flags.
  • Nothing updates the applications holding a connection string. They fail on their next connection.

Errors

Beyond 0 for success, this command exits with:

ExitKindMeaning
2usageInvalid arguments, unknown flag, or client-side validation failure.
3authNot authenticated, token revoked or expired, or forbidden for this team.
4confirmation_requiredA destructive operation stopped. Replay the command in confirm_command.
5not_foundThe named resource does not exist, or is not visible to this credential.
8upstreamThe Out Plane API returned a server error.

The code on the error object is one of confirmation.required, db.confirm_name_mismatch, db.not_found, usage.missing_argument. Branch on that, or on the exit status. The message is prose and changes.

On this page