Iskra API Reference
    Preparing search index...

    Class DbDriver<TSchema>

    Type Parameters

    • TSchema extends Record<string, unknown> = Record<string, never>

    Implements

    Index
    • Type Parameters

      • TSchema extends Record<string, unknown> = Record<string, never>

      Returns DbDriver<TSchema>

    db: IskraDrizzleDb<TSchema> | undefined
    name: string = 'db'
    • Parameters

      Returns Promise<void>

    • Liveness probe for readiness checks (e.g. web-kit's addReadinessCheck / k8s readiness). Runs a trivial SELECT 1 against the active dialect and resolves true on success or false on any failure — it never rejects.

      Returns Promise<boolean>

    • Applies the pending migrations in migrationsDir (generated with drizzle-kit generate) over the live connection, using Drizzle's migrator for the configured dialect. Requires start().

      It used to shell out to drizzle-kit migrate, which ignored both arguments and failed without a drizzle.config.ts. schemaPath is kept for compatibility; applying migrations does not need the schema.

      Parameters

      • Optional_schemaPath: string
      • migrationsDir: string = './drizzle'

      Returns Promise<void>

    • Register an observability callback that receives every SQL statement (and its bound params) Drizzle executes. Must be called before start, since Drizzle's logger is wired at connection time. A throwing callback is swallowed so observability never breaks a real query.

      Parameters

      Returns void

    • Returns Promise<void>

    • Returns Promise<void>

    • Run fn inside a database transaction, delegating to Drizzle's db.transaction. Callers receive the transaction-scoped db handle instead of reaching into the raw db. The dialect union means tx is typed as IskraDrizzleTx; narrow by dialect if you need dialect-specific APIs. Failures are wrapped in QueryError; the transaction is rolled back.

      With sqlite, transactions run one at a time on the single connection, and a query made outside tx while one is open is part of it. A nested transaction() call is rejected: it would wait for itself.

      Type Parameters

      • R

      Parameters

      Returns Promise<R>