Expand description
Schema migration detection and planning for SymbolTable evolution.
This module compares two SymbolTable versions, detects structural changes,
and produces a structured SchemaMigrationPlan with actionable steps.
§Overview
The migration engine:
- Snapshots both old and new schemas via
SchemaSnapshot - Diffs predicates, domains, and variable bindings
- Optionally detects renames using Dice-bigram similarity
- Classifies each
SchemaChangebyChangeSeverity - Generates ordered
SchemaMigrationSteps
§Example
use tensorlogic_adapters::{SymbolTable, DomainInfo, PredicateInfo};
use tensorlogic_adapters::schema_migration::{
compute_migration, MigrationConfig, SchemaChange,
};
let mut old = SymbolTable::new();
old.add_domain(DomainInfo::new("Person", 100)).unwrap();
let mut new_schema = SymbolTable::new();
new_schema.add_domain(DomainInfo::new("Person", 100)).unwrap();
new_schema.add_domain(DomainInfo::new("Animal", 50)).unwrap();
let config = MigrationConfig::default();
let plan = compute_migration(&old, &new_schema, &config).unwrap();
assert!(!plan.is_empty());Structs§
- Migration
Config - Configuration for the migration engine.
- Schema
Migration Plan - The full migration plan produced by
compute_migration. - Schema
Snapshot - A lightweight snapshot of a
SymbolTablefor comparison purposes.
Enums§
- Change
Severity - Severity classification for a schema change.
- Migration
Error - Error type for migration computation and validation.
- Schema
Change - A single structural change detected between two schema versions.
- Schema
Migration Step - A concrete migration step to transform the old schema into the new schema.
Functions§
- compute_
migration - Compute the full migration plan needed to go from
old_schematonew_schema. - string_
similarity - Compute the Dice coefficient on character bigrams of two strings.
- validate_
plan - Validate that a migration plan is internally self-consistent.