Setu-TS
    Preparing search index...

    Interface DrizzleAdapterOptions

    DatabaseAdapterOptions narrowed for the Drizzle arm: the configured instance and the table registry are both required.

    0.2.0

    interface DrizzleAdapterOptions {
        dialect?: SqlJsonDialect;
        drizzleInstance: DrizzleDatabaseIdentity;
        drizzleTables: Record<string, unknown>;
        entities?: Readonly<Record<string, DrizzleCompositeKeyOptions>>;
        logQueries?: boolean;
        poolStats?: () => DatabasePoolCapacity;
        prismaClient?: unknown;
        provider?: PrismaSqlProvider;
        transactionTimeout?: number;
        url?: string;
    }

    Hierarchy (View Summary)

    Index
    dialect?: SqlJsonDialect

    The SQL dialect, used only to translate a nested JSON filter path (field: ['profile', 'city']). No two dialects spell JSON extraction alike: PostgreSQL uses #>>, MySQL JSON_UNQUOTE(JSON_EXTRACT(...)) and SQLite json_extract.

    Absent, the adapter reads the dialect off the Drizzle instance, which covers every instance Drizzle ships. Set it when that detection cannot name the dialect — a nested-path filter is then refused by name rather than emitted in a guessed syntax that would return wrong rows.

    0.2.0

    drizzleInstance: DrizzleDatabaseIdentity

    The opaque configuration returned by createDrizzleDatabase(database, transactionBridge). Required.

    0.2.0

    drizzleTables: Record<string, unknown>

    Entity name → real Drizzle table definition. Required, and must hold at least one entry.

    0.2.0

    entities?: Readonly<Record<string, DrizzleCompositeKeyOptions>>

    Per-entity overrides keyed by the entity name passed to IRepository.getRepository.

    The only override exercised today is primaryKey, which replaces the hardcoded 'id' column the adapter reads when building findById/ update/delete predicates. An absent entry falls back to ['id'], preserving the prior behaviour (including its refuse-by-name when id is missing from the table).

    import { DatabasePlugin } from '@setu-ts/database-plugin';

    app.register(DatabasePlugin({
    type: 'drizzle',
    options: {
    drizzleInstance: createDrizzleDatabase(db, bridge),
    drizzleTables: { Tenant: tenants, TenantFlag: tenantFlags },
    entities: {
    TenantFlag: { primaryKey: ['tenantId', 'flag'] },
    },
    },
    }));

    0.2.0

    logQueries?: boolean

    When true, log SQL queries to the registered logger.

    0.1.0

    poolStats?: () => DatabasePoolCapacity

    Application-owned callback reporting the driver's connection-pool counters (M90b). The application reads its own driver's documented pool API — the configured Drizzle identity is opaque to this package — and the adapter publishes the returned DatabasePoolCapacity snapshot to the database health indicator through an internal seam.

    Omitted, the indicator carries no capacity fields. No threshold is applied: saturation is data, not policy.

    app.register(DatabasePlugin({
    type: 'drizzle',
    options: {
    drizzleInstance: createDrizzleDatabase(db, bridge),
    drizzleTables,
    poolStats: () => ({
    total: pool.totalCount,
    idle: pool.idleCount,
    waiting: pool.waitingCount,
    }),
    },
    }));

    0.5.0

    prismaClient?: unknown

    Inject an application-generated Prisma v7 client. This is required for the Prisma adapter because generated-client output belongs to the application rather than this package — see PrismaAdapterOptions, which makes that a compile error rather than a startup throw.

    A Prisma 7 client needs a driver adapter of its own (new PrismaClient({ adapter: new PrismaPg({ connectionString }) })); the engine-bundled new PrismaClient() constructor was removed in v7.

    0.1.0

    The SQL connector the injected Prisma client is bound to.

    Only contains is connector-sensitive in the Prisma adapter. When omitted the adapter reads the client's active provider structurally at connect() time; when that cannot be determined, a contains filter throws UnsupportedFilterOperatorError naming this option as the fix. Pass it explicitly when the adapter cannot detect the connector.

    0.2.0

    transactionTimeout?: number

    Timeout (ms) for Prisma interactive transactions. Defaults to 30_000. Prisma's default is ~5s which is too short for a full Unit of Work.

    Read by the Prisma adapter only; Memory and Drizzle ignore it.

    0.1.0

    url?: string

    Database connection URL (e.g., postgresql://localhost:5432/mydb).

    Prisma v7 clients are generated at an application-selected output path and receive their connection configuration when the application constructs them. Inject that generated client through prismaClient instead. This field remains for source compatibility and is not read by the Prisma adapter.

    0.1.0