We value your privacy

This site uses cookies to improve your browsing experience, analyze site traffic, and show personalized content. See our Privacy Policy.

  1. MooseStack
  2. Moose Migrate

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

PhaseWhat it doesPage
GenerateRun moose generate migration --save to produce a committed migration file from your code changes.Generate migrations
ApplyOn 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:

  1. Your code — tables and streams defined in your application
  2. 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:

OptionBehavior
FULLY_MANAGED (default)Moose modifies resources to match your code, including destructive operations.
DELETION_PROTECTEDMoose modifies resources to match your code but blocks destructive operations.
EXTERNALLY_MANAGEDMoose does not modify resources; you manage the schema manually.

See also

  • Plan Reference — operation reference and file-format details
  • Failed migrations — recovery guidance

On this page

Two phasesHow it worksLifecycle controlSee also
Edit this page
FiveonefourFiveonefour
Fiveonefour Docs
MooseStackHostingTemplatesGuides
Release Notes
Source577
  • Overview
Build a New App
  • 5 Minute Quickstart
  • Browse Templates
  • Existing ClickHouse
Add to Existing App
  • Next.js
  • Fastify
Fundamentals
  • Moose Server
  • MooseDev MCP
  • Language Server
  • Data Modeling
Moose Modules
  • Moose OLAP
  • Moose Streams
  • Moose Workflows
  • Moose APIs & Web Apps
Deployment & Lifecycle
  • Moose Dev
  • Moose Migrate
  • Moose Deploy
Reference
  • API Reference
  • Query Layer
  • Testing Utilities
  • Data Types
  • Table Engines
  • CLI
  • Configuration
  • Observability Metrics
  • Help
  • Release Notes
Contribution
  • Documentation
  • Framework