Expand description
Schema Evolution - Online Schema Changes
This module provides backwards-compatible schema evolution for SochDB, allowing schema changes without full table rewrites through:
- Schema Versioning: Each schema has a monotonic version number
- Migration Registry: Registered transformations between versions
- Lazy Migration: Rows are migrated on-read when version mismatch detected
- Background Compaction: Asynchronous migration during idle time
§Design
┌─────────────────────────────────────────────────────────────┐
│ Schema Version Graph │
│ │
│ v1 ──────────────────────────────────────────────────────→ │
│ ↓ │
│ v2 (add column "email") │
│ ↓ │
│ v3 (rename "name" → "full_name", add "created_at") │
│ ↓ │
│ v4 (drop "legacy_field") │
└─────────────────────────────────────────────────────────────┘
Rows carry their schema version. On read:
1. Check row version vs current schema version
2. If mismatch, apply migration chain (v_row → v_current)
3. Return migrated row (optionally rewrite in background)Structs§
- Evolution
Stats - Statistics for schema evolution operations
- Evolution
Stats Snapshot - Migration
- Migration between two schema versions
- Schema
Evolution Manager - Schema evolution manager that wraps a registry with additional features
- Schema
Id - Unique schema identifier (table/collection name + version)
- Schema
Registry - Schema version registry with migration graph
- Versioned
Row - Row with embedded schema version for lazy migration
Enums§
- Schema
Change - Describes a single schema change operation
- Type
Converter - Type conversion function for schema evolution
Type Aliases§
- Schema
Version - Schema version identifier