modelvault-core 0.15.2

Core engine for ModelVault — application-focused embedded storage with model schemas, validation, and migrations.
Documentation
//! Migration planning and helpers.
//!
//! ModelVault keeps schema evolution conservative by default. When a proposed schema change requires
//! rewriting existing data (e.g. adding a required field), callers can plan and then execute a
//! migration using helpers provided here.

use crate::schema::SchemaChange;

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum MigrationStep {
    /// Backfill a missing top-level field for all existing rows in a collection.
    BackfillTopLevelField { field: String },
    /// Backfill a missing field at a multi-segment path for all existing rows.
    BackfillFieldAtPath { path: crate::schema::FieldPath },
    /// Rebuild index entries for a collection (typically after adding a new index definition).
    RebuildIndexes,
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MigrationPlan {
    pub change: SchemaChange,
    pub steps: Vec<MigrationStep>,
}