mafw.db.migration.cli_support

CLI support for migration service connections.

author:

Bulgheroni Antonio

mafw.db.migration.cli_support._echo_outcome(outcome: Any) → None[source]

Print the human-readable messages carried by a migration outcome.

Parameters:

outcome (Any) – The MigrationOutcome.

mafw.db.migration.cli_support._open_migration_manager(steering_file: str, *, directory_override: str | None) → Iterator[Any][source]

Open a migration manager from a steering file.

Loads the plugins that register models, reads the steering file, connects to the configured database, resolves the migration directory against the steering file’s own directory (the stable base), and yields a bound MigrationManager. The database connection is always closed on exit.

Parameters:
  • steering_file (str) – Path to the TOML steering file.

  • directory_override (str | None) – Optional CLI migration-directory override.

Returns:

A context manager yielding the migration manager.

Return type:

Iterator[Any]

Raises:

click.ClickException – when the steering file or database is invalid.