property DrizzleCompositeKeyOptions.primaryKey
Since 0.2.0

Primary-key column(s) for this entity.

Defaults to ['id'] when absent — the adapter's previous hardcoded path, so an unconfigured entity behaves exactly as it did before, including its refuse-by-name on an absent id column.

Pass an array for a composite-key table that has no id column but carries a compound primary key (e.g. { tenantId, flag }).

Examples

Example 1

// Scalar key (default path).
entities: { User: {} }

// Composite key — replace the hardcoded 'id'.
entities: {
  TenantFlag: { primaryKey: ['tenantId', 'flag'] },
}

Type

string | readonly string[]

Usage

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