tose db
Manage databases in your workspace.
Workspace-Level Command
Database commands operate at the workspace level, not the project level. You only need to be authenticated and have a workspace selected.
tose db list
List all databases in the workspace.
Synopsis
tose db listUsage
$ tose db list
NAME TYPE STATUS
production-db postgres active
redis-cache redis active
backup-db postgres stoppedJSON Output
$ tose db list --json{
"schema_version": "1",
"status": "ok",
"success": true,
"data": [
{
"id": "db_abc123",
"name": "production-db",
"db_type": "postgres",
"status": "active"
},
{
"id": "db_def456",
"name": "redis-cache",
"db_type": "redis",
"status": "active"
}
]
}tose db create
Create a new database.
Synopsis
tose db create [--name <name>] [--type <type>] [--server <id>]Description
Creates a database in your workspace. In a terminal, a missing --name or --type is asked interactively. --server is never prompted for. Without a terminal, or with --json, a missing --name or --type fails with INPUT_REQUIRED and names the flag to pass.
The CLI sends db_type and server_id to the API, as it requires.
Options
| Option | Description |
|---|---|
--name <name> | Database name |
--type <type> | Database type, see below |
--server <id> | Server to run the database on |
Supported Database Types
--type | Description |
|---|---|
postgres | PostgreSQL |
pgvector | PostgreSQL with the pgvector extension |
mysql | MySQL |
redis | In-memory key-value store |
mongo | MongoDB |
postgresql and mongodb are accepted as aliases for postgres and mongo. Any other value is rejected before a request is sent.
Choosing the server
- With one active server in the workspace, the CLI picks it automatically.
- With several active servers, pass
--server <id>. Without it the command fails with a validation error that lists the active servers (details.servers). - With no active server the command fails; add a server at tose.sh first.
Usage
$ tose db create
? Database name: my-app-db
? Database type:
❯ PostgreSQL
PostgreSQL with pgvector
MySQL
Redis
MongoDB
✓ Database "my-app-db" created
Status: provisioning. Connection details appear in `tose db info my-app-db` once it is active.Non-interactive, for scripts and agents:
tose db create --name my-app-db --type postgres --server srv_abc123 --jsonA new database may not be active yet, so connection details are not part of the create output. Read them with tose db info once the status is active.
JSON Output
The output is the database object returned by the API.
{
"schema_version": "1",
"status": "ok",
"success": true,
"data": {
"id": "db_abc123",
"name": "my-app-db",
"db_type": "postgres",
"status": "provisioning"
}
}tose db info
Show database connection details.
Synopsis
tose db info <name-or-id>Arguments
| Argument | Description |
|---|---|
<name-or-id> | Database name or ID |
Usage
$ tose db info production-db
Name: production-db
Type: postgres
Status: active
Port: 5432
User: user
DB: production-db
Connection URL:
postgresql://user:pass@db.tose.sh:5432/production-dbJSON Output
{
"schema_version": "1",
"status": "ok",
"success": true,
"data": {
"id": "db_abc123",
"name": "production-db",
"db_type": "postgres",
"status": "active",
"port": 5432,
"db_user": "user",
"db_name": "production-db",
"connection_url": "postgresql://user:pass@db.tose.sh:5432/production-db"
}
}Workflow: Connect Database to Project
After creating a database, set the connection URL as an environment variable:
# Create database
tose db create --name my-app-db --type postgres
# Copy the connection URL from `tose db info`, then set it as env var
tose env set DATABASE_URL=postgresql://user:pass@db.tose.sh:5432/my-app-db
# Redeploy to apply
tose redeployRelated Commands
tose env set- Set connection string as env vartose redeploy- Apply env changes