Optional ReadonlydialectThe 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.
ReadonlydrizzleThe opaque configuration returned by
createDrizzleDatabase(database, transactionBridge). Required.
ReadonlydrizzleEntity name → real Drizzle table definition. Required, and must hold at least one entry.
Optional ReadonlyentitiesPer-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'] },
},
},
}));
Optional ReadonlylogWhen true, log SQL queries to the registered logger.
Optional ReadonlypoolApplication-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.
Optional ReadonlyprismaInject 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.
Optional ReadonlyproviderThe 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.
Optional ReadonlytransactionTimeout (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.
Optional ReadonlyurlDatabase 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.
DatabaseAdapterOptionsnarrowed for the Drizzle arm: the configured instance and the table registry are both required.Since
0.2.0