pub enum MigrationsCommand {
Compose {
name: String,
allow_destructive: bool,
force_overwrite: bool,
workspace: Option<PathBuf>,
},
Status {
workspace: Option<PathBuf>,
},
Verify {
workspace: Option<PathBuf>,
strict: bool,
},
Attune {
target: Option<String>,
apply: bool,
record: bool,
record_ledger: bool,
record_reason: String,
squash: bool,
from: Option<String>,
publish: bool,
app: Option<String>,
workspace: Option<PathBuf>,
},
Apply {
workspace: Option<PathBuf>,
fake: bool,
reason: Option<String>,
node_id: Option<u32>,
single_node_dev: bool,
},
Repair {
command: RepairSubcommand,
},
Baseline {
version: String,
description: String,
reason: String,
app: Option<String>,
database: Option<String>,
workspace: Option<PathBuf>,
node_id: Option<u32>,
single_node_dev: bool,
},
}Variants§
Compose
Compose a new migration from descriptor inventory + last snapshot.
Fields
name: StringOperator-facing migration name. Sanitised down to a strict
identifier; defaults to migration when empty.
allow_destructive: boolAllow destructive (drop) operations or tombstoned-app migrations. Without this flag the compose path refuses destructive deltas with a structural error.
force_overwrite: boolDiscard hand-edits to existing migration files. Without
this flag compose refuses to overwrite any up or down
migration file whose current bytes do NOT match what the
deterministic emitter would freshly produce — the
byte-equality check stands in for a checksum compare
because the emitter is deterministic (same inputs always
produce the same bytes). The check is purely byte-level;
it does not read the pending JSON’s checksum_up field.
Status
Print the current state of the migration ledger, grouped by app. Read-only — does not acquire the workspace lock. Requires PostgreSQL 18 or later.
Verify
Compare live database catalog against the schema snapshot.
Read-only — does not acquire the workspace lock or execute DDL.
Exits 0 if no error-level diagnostics are found. Exits 1 on
runtime errors (config / pool / SQL). Exits 2 if the Postgres
server is below version 18.
Use --strict to upgrade out-of-order migration warnings (D622)
to errors, causing verify to exit non-zero when the ledger
contains out-of-order applied rows.
Fields
Attune
Reconcile local migration history with the ledger. Default
mode is a read-only diff between the on-disk SQL files and
the ledger. Attune is read-only by default — pass --apply
to commit ledger inserts / squash / parent-pointer writes.
--record updates the parent repo’s recorded submodule
pointer to the resolved Git target after successful
attunement. --squash --from <ver> collapses local history
into a single migration (localhost + dev_mode + dev profile +
DJOGI_ENV gates).
Requires PostgreSQL 18 or later — exits with code 2 if the
server is below the minimum.
Exit codes: 0 on success, 1 on runtime error (config / network
/ SQL / git), 2 on refusal (gate failure, arg validation,
below PG 18).
Fields
target: Option<String>Optional Git target to attune the local migration history
to — a local or remote commit / tag / branch. When
omitted, attune reconciles against the current on-disk
state. Resolution: tries local first, then git fetch --all + retries on failure.
apply: boolMutate the database / parent index. Without --apply,
attune is a dry-run — it scans, prints the diff, and
exits without inserting / deleting ledger rows or updating
the parent submodule pointer (per
docs/spec/configuration.md §14: “does not mutate the
database unless --apply is explicitly passed”).
record: boolIn Record mode (--record-ledger), insert ledger rows for
SQL files present on disk but absent from the ledger. With
a resolved <target> argument AND --apply, also update
the parent repo’s recorded submodule pointer to the target
SHA.
record_ledger: boolActivate Record mode — insert ledger rows for SQL files
present on disk but absent from the ledger. Distinct from
--record (which controls the parent submodule pointer).
Records the operator-supplied reason in partial_apply_note.
Does NOT execute SQL.
record_reason: StringWhen --record-ledger is set, the rationale recorded on
every inserted ledger row’s partial_apply_note.
squash: boolCoalesce every committed migration from --from to HEAD
into a single squashed migration. HISTORY REWRITE — gated
on localhost + dev profile + dev_mode + DJOGI_ENV.
publish: boolAfter a successful squash, push the rewritten
migrations/ submodule to its remote. Without this flag
the rewrite stays local. Squash NEVER auto-publishes.
Apply
Apply all pending migrations in ledger order. This is the canonical spelling;
djogi migrate apply is a compatibility alias.
Transaction semantics are per-segment: transactional
segments roll back on error; non-transactional segments
autocommit and may leave partial progress.
On crash or unexpected termination, re-run
djogi migrations apply. For partial non-transactional
progress, use djogi migrations repair resume-partial.
Existing-database adoption: use --fake to mark pending
migrations as applied without executing their SQL. This is for
databases whose schema already exists (from a prior tool, manual
DDL, or restored backup). Use djogi migrations verify or
manual inspection to confirm the schema matches the target state
before faking. The --fake flag respects the same out-of-order
policy as real apply; if CI/prod policy is Reject, fake-apply
on an out-of-order version is also rejected.
Node identity: for operations that execute SQL, supply
--node-id <id> (explicit cluster node) or
--single-node-dev (dev mode, binds node 1). Mutually exclusive.
Falls back to HEER_NODE_ID env var when neither flag is set.
Refuses without identity for non-dev operations (exit 2).
For previewing pending work without executing it, use
djogi migrations status.
If the command is interrupted after recording a ledger row with
a terminal status (applied, faked, baseline), re-running
reports VersionAlreadyApplied (exit 2). For non-terminal
statuses (failed, rolled_back), the stale row is removed and
re-apply proceeds automatically. If the snapshot is missing or
stale, reconcile it with djogi migrations attune or
repair snapshot-rebuild.
Fields
fake: boolRecord pending migrations as applied without executing
their SQL. For existing-database adoption only. Requires
--reason. Subject to the same out-of-order policy as real
apply; if CI/prod policy is Reject, fake-apply on an
out-of-order version is also rejected.
reason: Option<String>Reason for faking these migrations. Required when --fake
is set. Persisted to the ledger’s audit trail so future
inspections can understand why this version was recorded
without SQL execution. Has no effect on normal (non-fake)
apply.
Repair
Operator-confirmed repair flows for ledger drift, partial applies, and missing snapshots. Every subcommand requires explicit confirmation — invoking the CLI subcommand IS the operator acknowledgment.
Fields
command: RepairSubcommandThe specific repair operation to perform.
Baseline
Project the live database schema into a baseline ledger row and
snapshot. Use for existing databases being adopted under Djogi’s
migration ledger, where the schema already exists and compose +
apply cannot run on a populated database without a starting point.
Projects the live catalog into a single baseline ledger row
(no SQL runs against user tables) and writes the projected
snapshot so future migrations diff against the real DB state.
Invoking the subcommand IS the operator acknowledgment.
Requires PostgreSQL 18 or later — exits with code 2 if the
server is below the minimum.
Exit codes: 0 on success, 1 on runtime error (config / network /
SQL / projection failure), 2 on refusal (empty --reason, duplicate
version, unresolvable database URL, snapshot-persist failure after
ledger insert, session-pinning correctness failure, or below PG 18).
Fields
version: StringVersion label for the baseline ledger row (e.g.
V00000000000000__baseline). Must be unique in the ledger.
app: Option<String>App label for the migration bucket. Defaults to the global bucket (empty string) when not specified.
Trait Implementations§
Source§impl FromArgMatches for MigrationsCommand
impl FromArgMatches for MigrationsCommand
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut<'b>(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§impl Subcommand for MigrationsCommand
impl Subcommand for MigrationsCommand
Source§fn augment_subcommands<'b>(__clap_app: Command) -> Command
fn augment_subcommands<'b>(__clap_app: Command) -> Command
Source§fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command
fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command
Command so it can instantiate self via
FromArgMatches::update_from_arg_matches_mut Read moreSource§fn has_subcommand(__clap_name: &str) -> bool
fn has_subcommand(__clap_name: &str) -> bool
Self can parse a specific subcommandAuto Trait Implementations§
impl Freeze for MigrationsCommand
impl RefUnwindSafe for MigrationsCommand
impl Send for MigrationsCommand
impl Sync for MigrationsCommand
impl Unpin for MigrationsCommand
impl UnsafeUnpin for MigrationsCommand
impl UnwindSafe for MigrationsCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<V> IntoPortableFieldValue<Option<V>> for V
impl<V> IntoPortableFieldValue<Option<V>> for V
Source§fn into_portable_field_value(self) -> Option<V>
fn into_portable_field_value(self) -> Option<V>
self into the field’s declared portable value type.
The returned value flows into Sassi’s Field<M, FieldValue>::eq /
.gt / .in_ / etc. as the right-hand-side operand. Implementors
must produce a value whose PartialEq / PartialOrd / Hash
behaviour matches the on-disk column ordering — otherwise Punnu and
the database row will disagree at evaluation time.Source§impl<V> IntoPortableFieldValue<Tracked<V>> for V
impl<V> IntoPortableFieldValue<Tracked<V>> for V
Source§fn into_portable_field_value(self) -> Tracked<V>
fn into_portable_field_value(self) -> Tracked<V>
self into the field’s declared portable value type.
The returned value flows into Sassi’s Field<M, FieldValue>::eq /
.gt / .in_ / etc. as the right-hand-side operand. Implementors
must produce a value whose PartialEq / PartialOrd / Hash
behaviour matches the on-disk column ordering — otherwise Punnu and
the database row will disagree at evaluation time.Source§impl<V> IntoPortableFieldValue<V> for V
impl<V> IntoPortableFieldValue<V> for V
Source§fn into_portable_field_value(self) -> V
fn into_portable_field_value(self) -> V
self into the field’s declared portable value type.
The returned value flows into Sassi’s Field<M, FieldValue>::eq /
.gt / .in_ / etc. as the right-hand-side operand. Implementors
must produce a value whose PartialEq / PartialOrd / Hash
behaviour matches the on-disk column ordering — otherwise Punnu and
the database row will disagree at evaluation time.Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);