drupflare/worker - v1.0.4
    Preparing search index...

    Class SqlMigrator

    First-run migration, replayed in JavaScript into ctx.storage.sql. A JS loop is divisible where a synchronous wasm call is not: one chunk per invocation, cursor in DO SQLite, resume next time.

    The cursor advances inside the same transactionSync() as the chunk's statements, so a killed invocation retries from a consistent point (a ctx.storage.put() cursor would be a second commit). loadManifest, loadChunk and now are injected so gate tests replay off disk.

    Index
    loadChunk: (file: string, index: number) => Promise<MigrationChunk>

    fetches one chunk by file name and index

    loadManifest: () => Promise<MigrationManifest>

    fetches the manifest (memoised by getManifest())

    the manifest once loaded

    now: () => number

    the clock, injectable for tests

    sql: SqlLike

    the tenant database the chunks replay into

    storage: StorageLike

    the storage handle whose transactionSync() makes a chunk atomic with its cursor

    • Replays up to maxChunks chunks (default one; Infinity is the paid and local path), then returns. A chunk that throws leaves the database as it was and records the error without advancing the cursor, so the next call retries it; skipping would leave a site quietly missing rows.

      Parameters

      Returns Promise<MigrateStepResult>