brainy/src/migration/migrations.ts
David Snelling 39b099cafc 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
2026-02-09 16:13:14 -08:00

21 lines
634 B
TypeScript

/**
* 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
// }
]