CLI Reference¶
Pure command lookup for dbwarden CLI. The CLI option inventory lists every built-in argument, option, type, and default from the current CLI.
Safety-Scoped Options¶
| Command | Option | Effect |
|---|---|---|
make-migrations |
--split-at-severity LEVEL |
Defer operations at or above LEVEL plus dependent operations |
make-migrations |
--strict-pending / --no-strict-pending |
Override refusal of pending files without composable plans |
make-migrations |
--dry-run |
Preview artifacts without writing |
migrate |
--max-severity LEVEL |
Apply a strict version prefix; severity stop exits 3 |
migrate |
--force |
Acknowledge risks without changing the ceiling |
check |
--write-plan [--all] [VERSION] |
Statically classify SQL; unresolved files exit 4 |
merge |
--dry-run, --split-at-severity LEVEL |
Preview or split reconciliation |
reconcile |
--force, --split-at-severity LEVEL |
Acknowledge and split environment repair |
rebase |
--dry-run |
Alias of --check; no mutation |
LEVEL is SAFE, INFO, WARN, or CRITICAL. See Safety-scoped migrations for plans, UNKNOWN handling, configuration, and exit-code compatibility.
Syntax¶
Global options¶
| Option | Description |
|---|---|
--dev |
Use dev_database_url and dev_database_type for selected database |
--strict-translation |
Fail on unsupported/lossy dev SQLite translation |
--disable-skip |
Do not skip databases configured with skip_if_missing |
--debug |
Enable DEBUG-level logging (shows per-file model scanning on make-migrations) |
--debug-level <LEVEL> |
Set an exact log level: trace, debug, info, warning, error, critical, or 5/10/20/30/40/50 |
--log-level <COMPONENT:LEVEL> |
Per-component log level (repeatable). Example: --log-level snapshot:debug |
--json/-j |
Emit structured JSON for display commands and JSON-formatted logs |
--help |
Show help |
--debug/--debug-level set the logging severity and compose with the
per-command --verbose/-v flag, which controls INFO-level verbosity. Use both
(--debug plus -v) for DEBUG diagnostics with verbose INFO output. If both
--debug and --debug-level are given, --debug-level wins. trace (or 5)
is below debug and additionally logs per-statement SQL during migration
commands.
--json switches display commands (status, history, database list,
settings show, config, version, lock-status) to machine-readable JSON
and also formats the command's log output as newline-delimited JSON (the same
effect as DBWARDEN_LOG_JSON=true). Commands with their own format option
(check, check-db, check-impact, diff, plugin list, plugin info)
honor the global flag when no explicit format is given.
Configuration¶
settings show¶
database list¶
Migration authoring¶
make-migrations¶
$ dbwarden make-migrations "create users table" --database primary
$ dbwarden make-migrations --verbose --database primary
$ dbwarden --debug make-migrations --database primary
$ dbwarden --debug-level warning make-migrations --database primary
$ dbwarden make-migrations --plan --database primary
$ dbwarden make-migrations --rename users.username:email --database primary
$ dbwarden make-migrations --rename-table users:accounts --database primary
$ dbwarden make-migrations --safe-type-change --database primary
Options:
--database/-d: Target database--plan: Print migration plan JSON without writing files--sql: Output raw migration SQL to stdout without writing files--offline: Use model state file instead of live database (runexport-modelsfirst)--verbose/-v: Verbose output--debug/--debug-level <LEVEL>: Global options (see Global options table). DEBUG shows every model file scanned during discovery.--rename: Repeatable. Declare a column rename in formattable.old_name:new_name.--rename-table: Repeatable. Declare a table rename in formatold_table:new_table.--safe-type-change: Multi-step safe type change strategy.--concurrent/--no-concurrent: Use concurrent index creation (default: on).--clickhouse-engine-recreate: Allow automatic ClickHouse table rebuild on engine change.--drop-preserved-clickhouse-table/--keep-preserved-clickhouse-table: Drop or keep the preserved old ClickHouse table after engine-recreate swap.--postgres-auto-using: Emit activeUSINGclause on PostgreSQLALTER COLUMN TYPE(default: commented out).--type/-t: Output prefix:versioned(default),ra/runs_always, orroc/runs_on_change.--perf: Log SQL-generation phase timing.
See make-migrations for full documentation including rename detection, column-level changes, schema snapshots, and plan format.
new¶
$ dbwarden new "manual hotfix" --database primary
$ dbwarden new "backfill" --database primary --version 0042
$ dbwarden new "seed data" --database primary --type ra
Options: --database, --version, --type/-t
generate-models¶
$ dbwarden generate-models --output ./models/ --database primary
$ dbwarden generate-models --database primary --single-file
$ dbwarden generate-models --database primary --tables users,posts
$ dbwarden generate-models --database primary --exclude-tables logs,audit
Options: --output/-o (default models), --tables, --exclude-tables, --clickhouse-engines, --relationships, --dialect, --single-file, --base, --database/-d
export-models¶
$ dbwarden export-models --database primary
$ dbwarden export-models --database primary --output .dbwarden/model_state.json
Exports current model definitions to a JSON state file for offline migration diffs.
Important: The model state file is used for offline migration generation. It is auto-generated and committed to version control. If accidentally deleted, restore it from git or regenerate it by running
dbwarden export-models --database <db>against a live database. Without it, offline commands likemake-migrations --offlinewill not work, but online operations are unaffected.
Options: --output/-o (default .dbwarden/model_state.json), --database/-d
diff¶
$ dbwarden diff --database primary
$ dbwarden diff --database primary --out json
$ dbwarden diff --database primary --out sql
$ dbwarden diff --database primary --offline
Read-only model-vs-database comparison. No files are written.
Options: --database/-d, --out/-o (table, json, sql), --offline, --verbose/-v
check-impact¶
$ dbwarden check-impact 0042 --database primary
$ dbwarden check-impact 0042 --database primary --out json
$ dbwarden check-impact 0042 --database primary --scan-path app/
$ dbwarden check-impact path/to/primary__0042_add_bio.plan.json
Scans your codebase for references to schema elements affected by a migration.
| Option | Description |
|---|---|
migration |
Migration version (e.g. 0042) or plan file path (required) |
--out/-o |
Output format: text (default) or json |
--scan-path |
Directory to scan for affected code (default: .) |
--deep |
Enable deep introspection (imports models live) |
--verbose/-v |
Include INFO-level operations in the scan |
--database/-d |
Target database name |
Migration execution¶
migrate¶
$ dbwarden migrate --database primary
$ dbwarden migrate --all
$ dbwarden migrate --database primary --to-version 0010
$ dbwarden migrate --database primary --count 2
$ dbwarden migrate --database primary --with-backup
$ dbwarden migrate --database primary --baseline --to-version 0005
Options:
--database,--all--to-version,--count--baseline--with-backup,--backup-dir--dry-run(show what would be applied without executing)--sandbox(apply in a temporary sandbox database)--apply-seeds(apply pending seeds after migrations, overrides config)--defer-snapshots(write one final schema snapshot instead of one after every migration)--verbose--perf(log per-SQL-statement timing breakdowns)
rollback¶
$ dbwarden rollback --database primary
$ dbwarden rollback --database primary --count 2
$ dbwarden rollback --database primary --to-version 0007
Options: --database, --count, --to-version, --verbose, --perf
downgrade¶
Options: --to (required), --database, --verbose, --perf
make-rollback¶
Generates a .rollback.sql file for the given migration file.
snapshot¶
Outputs the DDL schema of the specified table.
Seed management¶
seed create¶
$ dbwarden seed create "seed initial data" --database primary
$ dbwarden seed create "populate lookup tables" --database primary --type python
Options: --database, --type (sql or python, default sql), --verbose
seed apply¶
$ dbwarden seed apply --database primary
$ dbwarden seed apply --database primary --version 0003
$ dbwarden seed apply --database primary --dry-run
$ dbwarden seed apply --all
Options: --database, --all (-a), --version, --dry-run, --verbose
seed list¶
Options: --database, --all, --prune, --verbose
seed rollback¶
$ dbwarden seed rollback --database primary
$ dbwarden seed rollback --database primary --count 2
$ dbwarden seed rollback --database primary --to-version 0003
$ dbwarden seed rollback --all
Options: --database, --count, --to-version, --all, --verbose
seed export¶
$ dbwarden seed export --database primary
$ dbwarden seed export --all
$ dbwarden seed export --database clickhouse --output-dir ./seeds
Export code seeds to ROC SQL files for stateless production application.
Options: --database/-d, --all/-a, --output-dir/-o (default seeds/)
Inspection and diagnostics¶
status¶
history¶
check-db¶
Output formats: txt, json, yaml, sql
check¶
$ dbwarden check --database primary
$ dbwarden check --database primary --force
$ dbwarden check --database primary --data
$ dbwarden check --database primary --out json
$ dbwarden check --write-plan 0042 --database primary
$ dbwarden check --write-plan --all
Output formats: txt, json
The live command combines model-versus-database findings with the safety of SQL that can still execute: unapplied versioned files, all runs-always files, and runs-on-change files whose checksum changed since their recorded execution. Superseded files are excluded. A trusted checksum-bound plan supplies the file's classification when present; otherwise dbwarden classifies the SQL in memory without writing a sidecar. Pending WARN and CRITICAL operations require --force. An incompletely classified file is UNKNOWN and always blocks, even with --force. Declarative-data drift requested through --data also cannot be forced.
Locking¶
lock-status¶
unlock¶
Merge handling¶
merge¶
rebase¶
reconcile¶
Plugin management¶
See the Plugins guide for the trust model and development docs.
plugin list¶
Shows discovered plugins with tier, trust/load state, registered hooks, object handlers, and lock status. Use --load to import trusted plugins without prompting and inspect their registered handlers and migration categories. Default inspection does not import plugins.
Options: --format/-f (table or json, default table), --load (import trusted plugins before inspection)
plugin info¶
Shows entry point, tier, trust/load state, hooks, official repository, approved minimum version, and lockfile provenance. Exits 1 if the plugin is not found. Accepts --load; JSON includes migration_categories.
Options: --format/-f (table or json, default table)
plugin add¶
$ dbwarden plugin add dbwarden-fastapi
$ dbwarden plugin add dbwarden-fastapi --version 0.2.0 --uv
$ dbwarden plugin add dbwarden-example --dry-run
Installs a plugin. Official plugins are provenance-verified and fail closed if verification is unavailable; community plugins are installed but not trusted (run plugin trust next).
Options: --uv (use uv add instead of pip), --version (pin an exact version), --dry-run (print the plan without installing)
plugin remove¶
Uninstalls the distribution and removes its consent and lockfile entries.
Options: --uv (use uv remove instead of pip), --dry-run (print the plan without uninstalling)
plugin trust¶
Records consent for the installed version of a community plugin in .dbwarden/consent.toml. Consent is version-specific.
plugin untrust¶
Revokes consent for a community plugin.
plugin categories¶
Loads trusted plugins without prompting and lists built-in/custom migration groups with name, order, and owning plugin. Default output is a table. status also displays each generated file's category.
Utility¶
recover-model-state¶
Recovers a deleted model state file by replaying migrations in a sandbox.
Options: --database/-d
config¶
version¶
For worked command examples, see the Cookbook & Examples.