Skip to main content

Class: MigrationEngine

Defined in: packages/agentos/src/cognition/rag/migration/MigrationEngine.ts:57

Constructors​

Constructor​

new MigrationEngine(): MigrationEngine

Returns​

MigrationEngine

Methods​

migrate()​

static migrate(options): Promise<MigrationResult>

Defined in: packages/agentos/src/cognition/rag/migration/MigrationEngine.ts:77

Migrate data between any two backends.

The engine:

  1. Connects to source and target, and runs the scope-id form handshake for each brain the source holds (brain_meta.scope_id_form, which a learning layer writes): where the two sides disagree in a way a copy of the rows as they are cannot keep, it refuses the whole migration, naming the record, before it copies any table. A source brain with the record whose user and persona scope ids read the same in both forms is copied as a plain one, and a target without the record gets none.
  2. Lists the source's tables and, for each one, reads rows in streaming batches.
  3. Creates the table in the target (if it doesn't exist).
  4. Writes each batch to the target.
  5. Reports progress after each batch.

Parameters​

options​

MigrationOptions

Source, target, batch size, and progress callback.

Returns​

Promise<MigrationResult>

Migration result with counts, duration, and any errors.