Skip to content

Latest commit

 

History

History
169 lines (113 loc) · 3.35 KB

File metadata and controls

169 lines (113 loc) · 3.35 KB

CLI Reference

This page summarizes the current command surface exposed by ditto.

Root command

ditto [command]

Global flags:

Flag Meaning
--config <path> Path to ditto.yaml
--db <path> Path to the SQLite metadata database
--version Print version information

ditto copy

ditto copy create

Create a clean copy from the latest dump or from --dump.

ditto copy create
ditto copy create --format=json --ttl 30m
ditto copy create --dump s3://bucket/latest.gz

Flags:

Flag Meaning
--dump <uri> Restore from a local path, s3://, or https:// source
--format <mode> Output style: auto, pipe, or json
--label <name> Run identifier override
--obfuscate Apply configured obfuscation post-restore
--ttl <duration> Override lifetime for this copy
--server <url> Use a remote ditto host

ditto copy run

Create a copy, run one command with DATABASE_URL injected, and destroy the copy on exit.

ditto copy run -- go test ./...
ditto copy run --ttl 30m -- migrate -database "$DATABASE_URL" up

Injected environment variables:

  • DATABASE_URL
  • DITTO_COPY_ID

Flags:

Flag Meaning
--dump <uri> Restore from a specific dump source
--label <name> Run identifier override
--obfuscate Apply configured obfuscation post-restore
--ttl <duration> Override lifetime for this copy
--server <url> Use a remote ditto host

Other copy subcommands

ditto copy list
ditto copy delete <id>
ditto copy logs <id>

Use copy list to inspect active copies and copy logs for lifecycle events tied to a specific ID.

ditto reseed

Refresh the local dump immediately:

ditto reseed

This command succeeds only after a new dump completes successfully.

ditto daemon

Keep the host ready for CI:

ditto daemon

Responsibilities:

  • refresh the dump on the configured schedule
  • delete copies after TTL expiry
  • refill the warm pool when enabled

ditto serve

Expose the copy lifecycle over HTTP:

ditto serve

Clients use --server=http://host:8080 plus DITTO_TOKEN when required.

ditto status

Show dump freshness and copy capacity:

ditto status

This is the first command to run when you want to verify host health.

ditto env

Use env when you want shell-friendly environment management.

ditto env export

Create a copy and print shell export lines:

eval "$(ditto env export)"

This sets DATABASE_URL and DITTO_COPY_ID in the current shell.

ditto env destroy

Destroy a copy created with env export:

ditto env destroy "$DITTO_COPY_ID"

ditto env -- <command>

Run one command with DATABASE_URL injected:

ditto env -- pytest tests/

env -- is effectively the same lifecycle as copy run.

ditto erd

Generate an ERD from a temporary copy or directly from the source database:

ditto erd
ditto erd --format=dbml --output schema.dbml
ditto erd --source

Flags:

Flag Meaning
--format <type> Output format: mermaid or dbml
--output <path> Write output to a file
--source Connect to the source database directly
--server <url> Create the temporary copy via a remote ditto host