Home / Class/ UniqueConstraint Class — drizzle-orm Architecture

UniqueConstraint Class — drizzle-orm Architecture

Architecture documentation for the UniqueConstraint class in unique-constraint.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  7820e57a_d7f7_31c5_af1d_bcc6092f9dea["UniqueConstraint"]
  85e88cbd_e923_5f37_9238_698bcacc84af["unique-constraint.ts"]
  7820e57a_d7f7_31c5_af1d_bcc6092f9dea -->|defined in| 85e88cbd_e923_5f37_9238_698bcacc84af
  75d3401e_8bc6_1cb5_e557_e8ea9cb6e59a["constructor()"]
  7820e57a_d7f7_31c5_af1d_bcc6092f9dea -->|method| 75d3401e_8bc6_1cb5_e557_e8ea9cb6e59a
  23e32da5_f3e0_3499_4106_4b4e5a0d65ea["getName()"]
  7820e57a_d7f7_31c5_af1d_bcc6092f9dea -->|method| 23e32da5_f3e0_3499_4106_4b4e5a0d65ea

Relationship Graph

Source Code

drizzle-orm/src/pg-core/unique-constraint.ts lines 57–73

export class UniqueConstraint {
	static readonly [entityKind]: string = 'PgUniqueConstraint';

	readonly columns: PgColumn[];
	readonly name?: string;
	readonly nullsNotDistinct: boolean = false;

	constructor(readonly table: PgTable, columns: PgColumn[], nullsNotDistinct: boolean, name?: string) {
		this.columns = columns;
		this.name = name ?? uniqueKeyName(this.table, this.columns.map((column) => column.name));
		this.nullsNotDistinct = nullsNotDistinct;
	}

	getName() {
		return this.name;
	}
}

Domain

Frequently Asked Questions

What is the UniqueConstraint class?
UniqueConstraint is a class in the drizzle-orm codebase, defined in drizzle-orm/src/pg-core/unique-constraint.ts.
Where is UniqueConstraint defined?
UniqueConstraint is defined in drizzle-orm/src/pg-core/unique-constraint.ts at line 57.

Analyze Your Own Codebase

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

Try Supermodel Free