property D1AdapterOptions.tables

Per-entity table and primary-key overrides, keyed by the entity name passed to getRepository().

An entity with no entry uses its own name as the table and 'id' as the key, which is why the zero-config path works for a schema whose table names already match.

Examples

Example 1

new D1Adapter(env.DB as ID1Database, {
  tables: { User: { table: 'users', primaryKey: 'user_id' } },
});

Type

Readonly<Record<string, D1EntityMapping>>

Usage

import { type D1AdapterOptions } from "cloudflare-plugin/src/index.ts";