Skip to main content

Module commands

Module commands 

Source
Expand description

Command implementations for the mz-deploy CLI.

Each subcommand lives in its own module and exposes a run() entry point that returns Result<T, CliError>. The executor module dispatches to these functions after setting up configuration and connections.

§Commands

  • new_project — Scaffold a new mz-deploy project directory.
  • compile — Parse and validate the project, optionally type-checking against a Docker container.
  • explain — Show the EXPLAIN plan for a materialized view or index.
  • stage — Deploy the project to a staging environment.
  • wait — Check hydration status of a staged deployment.
  • promote — Promote a staged deployment to production.
  • apply_all — Orchestrate all infrastructure apply steps.
  • abort — Roll back a staged deployment.
  • apply_sources — Create sources that don’t exist.
  • apply_tables — Create tables that don’t exist.
  • lock — Generate or refresh the types.lock file from the live region.
  • describe — Print a summary of the compiled project.
  • debug — Dump internal state for troubleshooting.
  • sql — Launch an interactive psql session using the active profile.
  • mcp — Proxy stdio JSON-RPC to the developer MCP HTTP endpoint.
  • list — List active deployments.
  • setup — Initialize deployment tracking infrastructure.
  • log — Show deployment history.
  • clusters — List or inspect cluster definitions.
  • roles — List or inspect role definitions.
  • apply_network_policies — Apply network policy definitions.
  • test — Run SQL unit tests against cached type information.

§Shared Types

  • ObjectRef — A (ObjectId, &DatabaseObject) pair used as the canonical unit of work when iterating over objects in dependency order.

Modules§

abort
Abort command - cleanup a staged deployment.
apply_all
Apply-all orchestrator — runs all infrastructure apply steps in dependency order.
apply_connections
Apply connections command - create missing connections and reconcile drifted ones.
apply_network_policies
Network policies apply command - converge live network policy state to match definitions.
apply_objects
Shared helpers for apply commands that reconcile grants/comments on database objects.
apply_secrets
Apply secrets command - create missing secrets and update existing ones.
apply_sources
Apply sources command - create sources that don’t exist in the database.
apply_tables
Apply tables command - create tables that don’t exist in the database.
clean
Clean command — delete the project’s target/ build directory.
clusters
Clusters apply command - converge live cluster state to match definitions.
compile
Compile command — validate project and show deployment plan.
debug
Debug command - test database connection.
delete
Delete command — drop an object from Materialize and remove its project file.
describe
Describe command - show detailed information about a specific deployment.
dev
mz-deploy dev — developer inner-loop overlay command.
explain
Explain command — show the EXPLAIN plan for a materialized view or index.
grants
Shared helpers for grant reconciliation across apply commands.
list
Deployments command - list active staging deployments.
lock
Generate data contracts command — resolves declared dependencies from project.toml into a types.lock file.
log
History command - show deployment history in chronological order.
mcp
Mcp command - proxy stdio JSON-RPC to Materialize’s developer MCP server.
new_project
Scaffold a new mz-deploy project directory.
profile
mz-deploy profile {list,set,current} — manage the project’s default profile.
promote
Promote command - promote staging deployment to production via ALTER SWAP.
roles
Roles apply command - converge live role state to match definitions.
setup
Setup command and connection validation for deployment tracking infrastructure.
sql
Sql command - launch an interactive psql session using the active profile.
stage
Stage command - deploy to staging environment with renamed schemas and clusters.
test
Test command — run unit tests against the database.
wait
Ready command - wait for staging deployment cluster hydration.

Type Aliases§

ObjectRef
Fully-qualified object identity paired with its typed SQL representation.