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.
Usage
outplane db database list <DATABASE>Arguments
| Argument | Type | Description |
|---|---|---|
DATABASE | string | Database name or id. Required. |
Output
| Field | Type | Description |
|---|---|---|
name | string | |
owner | string | null | The role that owns it. |
db | string | The instance it is inside. |
Examples
What is inside an instance
outplane db database list ordersRead 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 textWhat to Know
- Two levels share the word database: the managed instance, and the databases inside it.
db listis the first, this is the second.
Errors
Beyond 0 for success, this command exits with:
| Exit | Kind | Meaning |
|---|---|---|
2 | usage | Invalid arguments, unknown flag, or client-side validation failure. |
3 | auth | Not authenticated, token revoked or expired, or forbidden for this team. |
5 | not_found | The named resource does not exist, or is not visible to this credential. |
8 | upstream | The 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.
Usage
outplane db database create <DATABASE> <NAME> [flags]Arguments
| Argument | Type | Description |
|---|---|---|
DATABASE | string | Database name or id. Required. |
NAME | string | The database's name. Required. |
Flags
| Flag | Type | Description |
|---|---|---|
--owner | string | Role that owns it. Optional when the instance has one role. |
The global flags apply as well.
Output
| Field | Type | Description |
|---|---|---|
kind | string | One of role, database. |
name | string | |
owner | string | null | |
db | string | |
dbId | string | |
changed | bool |
Examples
One database per service
outplane db database create orders checkout --owner checkoutCheck 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,changedWhat 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:
| Exit | Kind | Meaning |
|---|---|---|
2 | usage | Invalid arguments, unknown flag, or client-side validation failure. |
3 | auth | Not authenticated, token revoked or expired, or forbidden for this team. |
5 | not_found | The named resource does not exist, or is not visible to this credential. |
8 | upstream | The 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.
Usage
outplane db database delete <DATABASE> <NAME> [flags]Arguments
| Argument | Type | Description |
|---|---|---|
DATABASE | string | Database name or id. Required. |
NAME | string | The database's name. Required. |
Flags
| Flag | Type | Description |
|---|---|---|
-y, --yes | bool | Acknowledge the deletion. Not sufficient on its own. |
--confirm-name | string | The name, typed again. |
The global flags apply as well.
Output
| Field | Type | Description |
|---|---|---|
kind | string | One of role, database. |
name | string | |
db | string | |
changed | bool |
Examples
See what would go
outplane db database delete orders old --dry-runThe confirmed form
outplane db database delete orders old --yes --confirm-name oldRead 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:
| Exit | Kind | Meaning |
|---|---|---|
2 | usage | Invalid arguments, unknown flag, or client-side validation failure. |
3 | auth | Not authenticated, token revoked or expired, or forbidden for this team. |
4 | confirmation_required | A destructive operation stopped. Replay the command in confirm_command. |
5 | not_found | The named resource does not exist, or is not visible to this credential. |
8 | upstream | The 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.