feat: add migration system with error handling, validation, and enterprise hardening
- MigrationRunner: per-entity error tracking (non-fatal), maxErrors bail-out, static validateMigrations() called in constructor, branch error propagation - RefManager: updateRefMetadata() method for clean metadata updates - brainy.ts: eliminate as-any casts in migration methods, use updateRefMetadata, forward maxErrors through full chain including branch migrations - Types: MigrationError interface, errors field on MigrationResult, maxErrors on MigrateOptions - Package exports: MigrationError type, migrate() on BrainyInterface, autoMigrate config - 31 integration tests covering error handling, validation, branch error propagation - Documentation: docs/guides/schema-migrations.md
This commit is contained in:
parent
e9f6a1b461
commit
39b099cafc
12 changed files with 2022 additions and 1 deletions
21
src/migration/migrations.ts
Normal file
21
src/migration/migrations.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* Migration registry
|
||||
*
|
||||
* Ordered array of migrations. Each migration runs exactly once per storage instance.
|
||||
* Add new migrations at the end — order matters.
|
||||
*/
|
||||
|
||||
import type { Migration } from './types.js'
|
||||
|
||||
export const MIGRATIONS: Migration[] = [
|
||||
// Empty for v7.16.0 — framework scaffolded, ready for future use.
|
||||
// Example of a future migration:
|
||||
//
|
||||
// {
|
||||
// id: '7.17.0-rename-status-field',
|
||||
// version: '7.17.0',
|
||||
// description: 'Rename metadata.state to metadata.status',
|
||||
// applies: 'nouns',
|
||||
// transform: (m) => 'state' in m ? { ...m, status: m.state, state: undefined } : null
|
||||
// }
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue