PrimaryKey Class — drizzle-orm Architecture
Architecture documentation for the PrimaryKey class in primary-keys.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 7fe8bf59_8287_5ded_594e_c8038d8f5b31["PrimaryKey"] 87a357d2_c2ec_b04d_8912_3b8be2a92815["primary-keys.ts"] 7fe8bf59_8287_5ded_594e_c8038d8f5b31 -->|defined in| 87a357d2_c2ec_b04d_8912_3b8be2a92815 7745cf7d_fad7_c590_c0ca_65b8a127484c["constructor()"] 7fe8bf59_8287_5ded_594e_c8038d8f5b31 -->|method| 7745cf7d_fad7_c590_c0ca_65b8a127484c c5a9b79a_2bc7_af65_fefb_82f84e0d8502["getName()"] 7fe8bf59_8287_5ded_594e_c8038d8f5b31 -->|method| c5a9b79a_2bc7_af65_fefb_82f84e0d8502
Relationship Graph
Source Code
drizzle-orm/src/pg-core/primary-keys.ts lines 48–62
export class PrimaryKey {
static readonly [entityKind]: string = 'PgPrimaryKey';
readonly columns: AnyPgColumn<{}>[];
readonly name?: string;
constructor(readonly table: PgTable, columns: AnyPgColumn<{}>[], name?: string) {
this.columns = columns;
this.name = name;
}
getName(): string {
return this.name ?? `${this.table[PgTable.Symbol.Name]}_${this.columns.map((column) => column.name).join('_')}_pk`;
}
}
Domain
Defined In
Source
Frequently Asked Questions
What is the PrimaryKey class?
PrimaryKey is a class in the drizzle-orm codebase, defined in drizzle-orm/src/pg-core/primary-keys.ts.
Where is PrimaryKey defined?
PrimaryKey is defined in drizzle-orm/src/pg-core/primary-keys.ts at line 48.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free