Home / Class/ Relations Class — drizzle-orm Architecture

Relations Class — drizzle-orm Architecture

Architecture documentation for the Relations class in relations.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  af6a7610_f2e8_fc8e_f294_171e48bcc5fc["Relations"]
  2f47d090_425d_2e56_2395_4c4d912316f0["relations.ts"]
  af6a7610_f2e8_fc8e_f294_171e48bcc5fc -->|defined in| 2f47d090_425d_2e56_2395_4c4d912316f0
  e01ce680_9c94_4dfa_d556_109215eeb681["constructor()"]
  af6a7610_f2e8_fc8e_f294_171e48bcc5fc -->|method| e01ce680_9c94_4dfa_d556_109215eeb681

Relationship Graph

Source Code

drizzle-orm/src/relations.ts lines 51–63

export class Relations<
	TTableName extends string = string,
	TConfig extends Record<string, Relation> = Record<string, Relation>,
> {
	static readonly [entityKind]: string = 'Relations';

	declare readonly $brand: 'Relations';

	constructor(
		readonly table: AnyTable<{ name: TTableName }>,
		readonly config: (helpers: TableRelationsHelpers<TTableName>) => TConfig,
	) {}
}

Domain

Frequently Asked Questions

What is the Relations class?
Relations is a class in the drizzle-orm codebase, defined in drizzle-orm/src/relations.ts.
Where is Relations defined?
Relations is defined in drizzle-orm/src/relations.ts at line 51.

Analyze Your Own Codebase

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

Try Supermodel Free