Moose Migrate
Moose Migrate synchronizes your code-defined schema with your production infrastructure. Add a field, change a type, drop a table — Moose generates reviewable migration files that apply the change safely on deploy.
Delta-based workflow — opt-in during beta
This documentation describes the delta-based migration workflow, enabled with features.migrate_with_deltas = true in moose.config.toml. The current default is false; once beta testing ends, delta migrations will become the default.
Two phases
| Phase | What it does | Page |
|---|---|---|
| Generate | Run moose generate migration --save to produce a committed migration file from your code changes. | Generate migrations |
| Apply | On deploy, moose migrate (Standalone CLI) or moose prod (Moose Server) executes the committed migration against your database. | Apply migrations |
How it works
Moose Migrate operates by comparing two states:
- Your code — tables and streams defined in your application
- Your database — the live schema in ClickHouse, Kafka, or Redpanda
When they differ, Moose generates operations (add/drop table, add/rename/retype column, create topic, etc.) and writes them as incremental migration files under ./migrations/. Each committed file records a diff from the previous migrated state and is applied exactly once in production.
Lifecycle control
For each table and stream, the LifeCycle configuration property controls what changes Moose is allowed to make:
| Option | Behavior |
|---|---|
FULLY_MANAGED (default) | Moose modifies resources to match your code, including destructive operations. |
DELETION_PROTECTED | Moose modifies resources to match your code but blocks destructive operations. |
EXTERNALLY_MANAGED | Moose does not modify resources; you manage the schema manually. |
See also
- Plan Reference — operation reference and file-format details
- Failed migrations — recovery guidance