Interface IMigrationTarget

Adapter for writing data to a migration target backend. Implementations exist for SQLite, Postgres, and Qdrant.

interface IMigrationTarget {
    ensureTable(table, sampleRow): Promise<void>;
    writeBatch(table, rows): Promise<number>;
    close(): Promise<void>;
}

Methods

  • Ensure the target schema/collection exists for a table. Creates it if it doesn't exist, using a sample row to infer column types.

    Parameters

    • table: string

      Table name to create.

    • sampleRow: Record<string, unknown>

      A sample row to derive schema from.

    Returns Promise<void>

  • Write a batch of rows to the target. Uses INSERT OR REPLACE / upsert semantics to handle duplicates.

    Parameters

    • table: string

      Table name to write to.

    • rows: Record<string, unknown>[]

      Array of row objects.

    Returns Promise<number>

    Number of rows successfully written.