Skip to main content

Module executor

Module executor 

Source
Expand description

Deployment execution utilities.

This module contains the DeploymentExecutor for running SQL statements during deployment, along with helper functions for collecting deployment metadata and generating environment names.

§ApplyPlan Lifecycle

compile project → connect client → plan phases → execute
                                       │
                    ┌──────────────────┼───────────────────┐
                    ▼                  ▼                   ▼
             prepare_schemas     add_phase(...)      execute(&client)
             (CREATE DB/SCHEMA)  (dry-run SQL)       (run all SQL)
  1. Compilecompile_apply_project_and_connect loads and validates the project.
  2. Plan — Each apply subcommand calls DeploymentExecutor::new_dry_run() to collect SQL without executing it, then packages results as ApplyResult phases.
  3. ExecuteApplyPlan::execute() runs setup statements first, then per-phase object statements. Objects sharing a transaction_group key are wrapped in a single BEGIN/COMMIT block with automatic ROLLBACK on failure.

Structs§

ApplyPlan
A complete apply plan: global setup + ordered phase results. Built incrementally by adding phases, then executed as a unit.
ApplyResult
Result of applying one phase (e.g. clusters, connections, etc.).
DeploymentExecutor
Helper for executing database object deployments.
ObjectResult
Result of applying a single object (cluster, role, connection, etc.).

Enums§

ObjectAction
What happened when applying a single object.

Functions§

collect_deployment_metadata
Collect deployment metadata (user and git commit).
compile_apply_project_and_connect
Compile the project (without type checking) and connect a planning client for database-object apply commands.
connect_apply_client
Connect a planning client for apply commands.
generate_random_env_name
Generate a unique 7-character hex identifier for deployments when no explicit environment name is provided.