Skip to content

Schema Versioning & Evolution (#99) - #106

Merged
nockawa merged 6 commits into
mainfrom
feature/99-schema-versioning
Feb 26, 2026
Merged

nockawa merged 6 commits into
mainfrom
feature/99-schema-versioning

Conversation

@nockawa

@nockawa nockawa commented Feb 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Complete implementation of Schema Versioning & Evolution — 5 phases delivering safe, incremental schema changes across database lifetimes.

  • Phase 1 — FieldId Stability (Phase 1: FieldId Stability #100): Persistent name-based FieldId assignment via FieldIdResolver, PreviousName attribute support, dense array packing
  • Phase 2 — Schema Validation (Phase 2: Schema Validation #101): SchemaDiff engine with field-level change detection, SchemaValidator for reopen-time safety checks, SchemaValidationException error reporting
  • Phase 3 — Compatible Evolution (Phase 3: Compatible Evolution #102): SchemaEvolutionEngine handling add/remove/reorder fields, safe type widenings (int→long, float→double), index add/remove, automatic entity migration with chunkId preservation
  • Phase 4 — Migration Functions (Phase 4: Migration Functions #103): MigrationRegistry for user-defined typed and byte-level migration chains, SchemaMigrationException for breaking changes without migration paths
  • Phase 5 — Operational Tooling (Phase 5: Operational Tooling #104): DatabaseSchema.Inspect() / ValidateEvolution(), SchemaHistoryR1 audit trail, MigrationProgress events, tsh commands (schema-fields, schema-diff, schema-validate, schema-history, schema-export)
  • BTree LeafEnumerator: ref struct enumerator walking the B+Tree leaf linked list — fixes GetSchemaHistory() and ComponentR1 loading bugs where sparse PKs caused silent data loss

Test plan

  • All 1537 existing tests pass (1 pre-existing failure in BulkMigration_Performance unrelated)
  • 5 new BTree EnumerateLeaves tests (empty, single leaf, multi-leaf, after deletions, sparse keys)
  • FieldId resolver tests (299 lines), stability tests (330 lines)
  • Schema validation unit + integration tests (718 lines)
  • Schema evolution tests (613 lines)
  • Migration function + registry tests (715 lines)
  • Operational tooling tests (227 lines)

🤖 Generated with Claude Code

@nockawa
nockawa merged commit 4a3fe7d into main Feb 26, 2026
5 checks passed
@nockawa
nockawa deleted the feature/99-schema-versioning branch February 26, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant