Deletion Protected
LifeCycle.DELETION_PROTECTED allows MooseStack to automatically add new database structures but prevents it from removing existing ones. This mode is perfect for production environments where you want to evolve your schema safely without risking data loss.
Behavior
What Moose will do:
- Add new columns, tables
- Modify column types (if compatible)
- Update non-destructive configurations
What Moose won't do:
- Drop columns or tables
- Perform destructive schema changes
Examples
DeletionProtectedExample.ts
import { OlapTable, LifeCycle, ClickHouseEngines } from "@514labs/moose-lib"; interface ProductEvent { id: string; productId: string; timestamp: Date; action: string;} const productAnalytics = new OlapTable<ProductEvent>("product_analytics", { orderByFields: ["timestamp", "productId"], engine: ClickHouseEngines.ReplacingMergeTree, lifeCycle: LifeCycle.DELETION_PROTECTED});