property DrizzleAdapterOptions.entities
Since 0.2.0

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).

Examples

Example 1

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'] },
    },
  },
}));

Type

Readonly<Record<string, DrizzleCompositeKeyOptions>>

Usage

import { type DrizzleAdapterOptions } from "database-plugin/src/index.ts";