The LifeCycle enum is a configuration property that controls how Moose Migrate manages individual OlapTable and Stream resources during schema evolution. Each resource can have its own lifecycle mode, enabling hybrid management models within a single application.
| Mode | Behavior | Default |
|---|---|---|
FULLY_MANAGED | Moose automatically modifies resources to match your code, including destructive operations (drops, deletions). | Yes (for new resources) |
DELETION_PROTECTED | Moose modifies resources to match your code but blocks destructive operations (drops, deletions). | No |
EXTERNALLY_MANAGED | Moose does not modify resources. You are responsible for managing the schema manually. | No |
The lifeCycle/life_cycle property is set in the configuration object when creating OlapTable or Stream instances.
import { OlapTable, OlapConfig, LifeCycle } from "@514labs/moose-lib"; const table = new OlapTable<DataType>("table_name", { lifeCycle: LifeCycle.FULLY_MANAGED});import { OlapTable, OlapConfig, LifeCycle } from "@514labs/moose-lib"; const table = new OlapTable<DataType>("table_name", { lifeCycle: LifeCycle.FULLY_MANAGED});import { Stream, StreamConfig, LifeCycle } from "@514labs/moose-lib"; const stream = new Stream<DataType>("stream_name", { destination: table, lifeCycle: LifeCycle.FULLY_MANAGED});For IngestPipeline, you can set lifecycle modes independently for the table and stream components.
import { IngestPipeline, IngestPipelineConfig, LifeCycle } from "@514labs/moose-lib"; const pipeline = new IngestPipeline<DataType>("pipeline_name", { table: { lifeCycle: LifeCycle.DELETION_PROTECTED }, stream: { lifeCycle: LifeCycle.FULLY_MANAGED }});| Scenario | Recommended Mode | Rationale |
|---|---|---|
| Development/iteration | FULLY_MANAGED | Allows rapid schema changes including destructive operations. |
| Production tables | DELETION_PROTECTED | Prevents accidental data loss while allowing schema evolution. |
| Legacy/shared tables | EXTERNALLY_MANAGED | Tables managed by another team or system. |
| CDC-managed streams | EXTERNALLY_MANAGED | Topics created by ClickPipes, PeerDB, or other CDC services. |
| Moose-managed streams | FULLY_MANAGED | Topics created and managed by Moose. |