djogi-cli
CLI for the Djogi Model-first Postgres framework — schema migrations, database management, and descriptor tooling.
djogi-cli provides the djogi command-line binary for Djogi adopters. It handles schema migrations, live-database operations, reference generation, and adopter-linked descriptor integration.
Primary Commands
djogi migrations apply— Apply pending migrations to the database, with optional--fakefor existing-schema adoption and--reasonfor metadata.djogi migrations compose— Generate up/down SQL migration pairs from model descriptor drift.djogi migrations status— Show the current state of the ledger, filesystem snapshots, and live database.djogi migrations verify— Validate that the live database matches the expected schema.djogi migrations repair— Reconcile drift between the ledger and live database after interrupted applies.djogi db reset— Drop, recreate, and replay migrations (triple-gated for safety).djogi db seed— Run SQL seeds fromseeds/<database>/*.sqlvia the seed ledger.djogi docs— Generate Markdown reference pages from the model descriptor inventory.djogi schema— Dump all registered models as deterministic JSON.
Descriptor-Free vs. Adopter-Linked
The published djogi binary on crates.io runs descriptor-free commands — those that work on pre-composed migration artifacts. Commands like apply, status, and seed run this way.
Descriptor-dependent commands (compose, verify, schema, docs) require an adopter-linked CLI built in your own workspace. Wire it with one dependency line:
[]
= "0.1.0-alpha.7"
= "0.1.0-alpha.7"
And a tiny binary entry point named djogi (src/bin/djogi.rs). The djogi_main! macro generates a main that references one model type per linked crate — forcing the linker to retain each crate's model inventory — then runs the CLI:
// List at least one #[derive(Model)] type from every model crate.
djogi_main!;
Or write the entry point by hand:
Exit Codes
- 0 — Command succeeded.
- 1 — Runtime error (e.g., database unavailable, migration failed).
- 2 — Refusal (e.g.,
--fakerejected due to data drift,resetcancelled by user).
Targets
PostgreSQL 18 and later.
See Also
- djogi — The main framework crate.
- Migrations guide — Schema evolution, drift detection, and recovery workflows.
- Adopter CLI guide — How to build and wire the adopter-linked CLI in your workspace.