Home / Class/ PrimaryKey Class — drizzle-orm Architecture

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
  bcdf4a4a_8109_2fa6_a8fe_427d9c1e987a["PrimaryKey"]
  a7ff59de_fcfb_68fe_6665_16d01fc2937f["primary-keys.ts"]
  bcdf4a4a_8109_2fa6_a8fe_427d9c1e987a -->|defined in| a7ff59de_fcfb_68fe_6665_16d01fc2937f
  3153bc18_827e_1c69_4a65_51c52e27d324["constructor()"]
  bcdf4a4a_8109_2fa6_a8fe_427d9c1e987a -->|method| 3153bc18_827e_1c69_4a65_51c52e27d324
  7b8b2ab1_8c5d_eef3_e1da_61ad1fd1dfee["getName()"]
  bcdf4a4a_8109_2fa6_a8fe_427d9c1e987a -->|method| 7b8b2ab1_8c5d_eef3_e1da_61ad1fd1dfee

Relationship Graph

Source Code

drizzle-orm/src/sqlite-core/primary-keys.ts lines 51–66

export class PrimaryKey {
	static readonly [entityKind]: string = 'SQLitePrimaryKey';

	readonly columns: SQLiteColumn[];
	readonly name?: string;

	constructor(readonly table: SQLiteTable, columns: SQLiteColumn[], name?: string) {
		this.columns = columns;
		this.name = name;
	}

	getName(): string {
		return this.name
			?? `${this.table[SQLiteTable.Symbol.Name]}_${this.columns.map((column) => column.name).join('_')}_pk`;
	}
}

Domain

Frequently Asked Questions

What is the PrimaryKey class?
PrimaryKey is a class in the drizzle-orm codebase, defined in drizzle-orm/src/sqlite-core/primary-keys.ts.
Where is PrimaryKey defined?
PrimaryKey is defined in drizzle-orm/src/sqlite-core/primary-keys.ts at line 51.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free