Home / Class/ Many Class — drizzle-orm Architecture

Many Class — drizzle-orm Architecture

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

Entity Profile

Dependency Diagram

graph TD
  776c65da_a3c4_5133_217d_969e536f67b3["Many"]
  2f47d090_425d_2e56_2395_4c4d912316f0["relations.ts"]
  776c65da_a3c4_5133_217d_969e536f67b3 -->|defined in| 2f47d090_425d_2e56_2395_4c4d912316f0
  1f506ef5_f916_8c0e_4c27_598524f17b1a["constructor()"]
  776c65da_a3c4_5133_217d_969e536f67b3 -->|method| 1f506ef5_f916_8c0e_4c27_598524f17b1a
  0ab4b259_5711_27c1_0ec7_58b25e6df3b8["withFieldName()"]
  776c65da_a3c4_5133_217d_969e536f67b3 -->|method| 0ab4b259_5711_27c1_0ec7_58b25e6df3b8

Relationship Graph

Source Code

drizzle-orm/src/relations.ts lines 100–122

export class Many<TTableName extends string> extends Relation<TTableName> {
	static override readonly [entityKind]: string = 'Many';

	declare protected $relationBrand: 'Many';

	constructor(
		sourceTable: Table,
		referencedTable: AnyTable<{ name: TTableName }>,
		readonly config: { relationName: string } | undefined,
	) {
		super(sourceTable, referencedTable, config?.relationName);
	}

	withFieldName(fieldName: string): Many<TTableName> {
		const relation = new Many(
			this.sourceTable,
			this.referencedTable,
			this.config,
		);
		relation.fieldName = fieldName;
		return relation;
	}
}

Domain

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free