Skip to content

CLI Reference

OptionShortEnvDefaultDescription
--version-vShow version and exit
--config <PATH>DBWARD_CONFIGConfig file path (standalone mode)
--merge-globalfalseMerge global config when —config is set
--database <NAME>DBWARD_DATABASETarget database
-e, --environment <ENV>-eDBWARD_ENVTarget environment
--format <FMT>humanOutput format: human, json
--allow-insecureDBWARD_ALLOW_INSECUREfalseAllow HTTP connections to non-local servers. Suppresses transport security warnings. Does not bypass OIDC+HTTP rejection.

Execute a SQL query through the approval workflow.

Terminal window
dbward execute "SELECT * FROM users LIMIT 10"
dbward execute -e production --database app "DELETE FROM sessions WHERE expired = true"
dbward execute --emergency --reason "outage fix" "UPDATE config SET v = 'x'"
OptionDefaultDescription
<SQL> (positional)Required. SQL statement
--emergencyfalseBreak-glass bypass (requires —reason)
--allow-ddlfalseAllow DDL in emergency mode (requires —emergency)
--reason <TEXT>Reason for this request
--output <PATH>Save result to file
--no-result-storefalseDo not store query result on server. Request metadata and SQL text are always retained for audit.
--result-format <FMT>tableDisplay format: table, json, csv, vertical
--timeout <SECS>Max wait time in seconds
--idempotency-key <KEY>Deduplication key
--share-with <SELECTOR>Share result (repeatable, e.g. group:team)
--ticket <ID>Metadata: ticket identifier
--repo <URL>Metadata: repository URL

Manage requests.

Terminal window
dbward request list
dbward request list --status pending --pending-for-me
OptionDefaultDescription
--limit <N>Max results
--status <STATUS>Filter by status
--pending-for-mefalseOnly show requests I can approve
--user <ID>Filter by requester
Terminal window
dbward request show <ID>
Terminal window
dbward request approve <ID>
dbward request approve <ID> --comment "Verified"
OptionDescription
--comment <TEXT>Approval comment
Terminal window
dbward request reject <ID> --reason "Add WHERE clause"
OptionDescription
--reason <TEXT>Rejection reason (alias: --comment)
Terminal window
dbward request cancel <ID>
OptionDescription
--reason <TEXT>Cancellation reason

Wait for execution and display result.

Terminal window
dbward request resume <ID>
dbward request resume <ID> --result-format json --output results.json
OptionDefaultDescription
--output <PATH>Save result to file
--result-format <FMT>tableDisplay format: table, json, csv, vertical

Retrieve execution result for a request.

Terminal window
dbward request result <ID>
dbward request result <ID> --execution <EXECUTION_ID>
dbward request result <ID> --output ./result.json
dbward request result <ID> --result-format csv
dbward request result <ID> --list
dbward request result <ID> --list --limit 10
OptionDefaultDescription
--execution <ID>latestRetrieve a specific execution’s result. Default: latest completed or failed execution
--output <PATH>Save result to a specific file (JSON)
--result-format <FMT>tableDisplay format: table, json, csv, vertical
--listList execution history for this request
--limit <N>20Max results (with --list)

--list cannot be combined with --execution, --output, or --result-format.

List shared results across requests.

Terminal window
dbward request results
dbward request results --limit 20
OptionDefaultDescription
--limit <N>50Max results

Database migrations.

Create a new migration file (local only).

Terminal window
dbward migrate create add_users_table

Show applied and pending migrations.

Terminal window
dbward migrate status

Apply pending migrations.

Terminal window
dbward migrate up
dbward migrate up --count 1
OptionDefaultDescription
--count <N>allMax migrations to apply
--ticket <ID>Metadata
--repo <URL>Metadata
--idempotency-key <KEY>Deduplication key
--share-with <SELECTOR>Share result

Rollback migrations.

Terminal window
dbward migrate down
dbward migrate down --count 2
OptionDefaultDescription
--count <N>1Migrations to rollback
--ticket <ID>Metadata
--repo <URL>Metadata
--idempotency-key <KEY>Deduplication key

Repair schema_migrations metadata. This modifies only the version tracking table, not the actual database schema. Verify DB state manually before use.

Terminal window
dbward migrate repair --emergency --action mark-applied --version 20240601_add_index --reason "partial migration recovery"
dbward migrate repair --emergency --action remove --version 20240601_add_index --reason "rolled back manually"
OptionDefaultDescription
--action <ACTION>(required)mark-applied or remove
--version <VERSION>(required)Migration version to repair
--emergency(required)Safety flag (break-glass permission required)
--reason <TEXT>(required)Reason for the repair (recorded in audit log)
--ticket <ID>Metadata
--repo <URL>Metadata

Search and verify audit logs.

Terminal window
dbward audit
dbward audit --user alice --since 2026-05-01 --output json
dbward audit --verify
OptionDefaultDescription
--limit <N>Max results
--user <ID>Filter by actor
--operation <OP>Filter by operation
--status <STATUS>Filter by status
--event-type <TYPE>Filter by event type
--category <CAT>Filter by category
--outcome <OUTCOME>Filter by outcome
--since <DATETIME>Events after this time
--until <DATETIME>Events before this time
--verifyfalseVerify hash chain integrity
--output <FMT>tableOutput format: table, json, csv

Manage API tokens.

Terminal window
dbward token create --subject alice --role developer
dbward token create --subject agent-1 --role agent-default --subject-type agent
dbward token create --subject bob --role developer --groups "backend,dba" --expires 90d
OptionDefaultDescription
--subject <ID>Required. Subject ID
--role <ROLE>Required. Role to assign
--subject-type <TYPE>useruser or agent
--name <NAME>Token display name
--groups <LIST>Comma-separated groups
--expires <DURATION>Expiry: 90d, 24h, 30m, ISO date, or datetime
Terminal window
dbward token list
dbward token list --subject alice --status active
OptionDescription
--subject <ID>Filter by subject
--status <STATUS>active or revoked
--type <TYPE>user or agent
Terminal window
dbward token revoke <ID>

Update your user profile.

Terminal window
dbward user update --slack-user-id U02CR3TMKKJ
OptionDescription
--slack-user-id <ID>Link Slack account for approval notifications

OIDC authentication.

Terminal window
dbward login # Browser-based login
dbward login --device # Device flow (headless/SSH)
dbward logout # Revoke tokens + delete credentials
dbward whoami # Show current identity
OptionDescription
--deviceUse device code flow (login only)

List registered databases.

Terminal window
dbward databases
dbward databases --format json

Show agent status (admin only).

Terminal window
dbward agents
dbward agents --format json

Show effective policy for a database/environment combination.

Terminal window
dbward policy resolve app production
dbward policy resolve app production --operation execute_dml
OptionDescription
<DATABASE> (positional)Required. Database name
<ENVIRONMENT> (positional)Required. Environment name
--operation <OP>Specific operation to resolve

Diagnose configuration and connectivity.

Terminal window
dbward doctor
dbward doctor --agent agent.toml
dbward doctor --server server.toml
OptionDefaultDescription
--agent <PATH>Validate agent config
--server <PATH>Validate server config
--timeout <SECS>5Network timeout per check

Initialize configuration files.

Terminal window
dbward init
dbward init --preset small-team --output-dir ./config
OptionDefaultDescription
--preset <NAME>Config template (e.g. small-team)
--output-dir <PATH>.Output directory
--non-interactivefalseSkip prompts
--forcefalseOverwrite existing files
--dry-runfalsePrint to stdout only

Start local development server + agent (single process).

Terminal window
dbward dev --database-url "postgres://localhost/myapp"
OptionDefaultDescription
--database-url <URL>Required. Database connection URL
--port <PORT>3000Server port

Start the dbward HTTP server (production).

Terminal window
dbward server start --config server.toml --listen 0.0.0.0:3000
OptionDefaultDescription
--config <PATH>dbward-server.tomlServer config file
--listen <ADDR>127.0.0.1:3000Listen address

Start the dbward agent.

Terminal window
dbward agent --config agent.toml
OptionDefaultDescription
--config <PATH>dbward-agent.tomlAgent config file

Start MCP stdio server (for AI IDE integration).

Terminal window
dbward mcp

No additional options. See MCP Reference.


Update dbward to the latest version.

Terminal window
dbward --version # check current version
dbward self-update # download and install latest

CodeMeaning
0Success
1Error (connection, validation, execution failure)
2Approval pending (request created but not yet approved)