Home / Function/ onConflictDoNothing() — drizzle-orm Function Reference

onConflictDoNothing() — drizzle-orm Function Reference

Architecture documentation for the onConflictDoNothing() function in insert.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  a7481a24_eb8f_555b_d34d_76f669a24719["onConflictDoNothing()"]
  fd9d3b22_d4f5_65bb_f267_7230f9181031["SQLiteInsertBase"]
  a7481a24_eb8f_555b_d34d_76f669a24719 -->|defined in| fd9d3b22_d4f5_65bb_f267_7230f9181031
  style a7481a24_eb8f_555b_d34d_76f669a24719 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/sqlite-core/query-builders/insert.ts lines 306–317

	onConflictDoNothing(config: { target?: IndexColumn | IndexColumn[]; where?: SQL } = {}): this {
		if (!this.config.onConflict) this.config.onConflict = [];

		if (config.target === undefined) {
			this.config.onConflict.push(sql` on conflict do nothing`);
		} else {
			const targetSql = Array.isArray(config.target) ? sql`${config.target}` : sql`${[config.target]}`;
			const whereSql = config.where ? sql` where ${config.where}` : sql``;
			this.config.onConflict.push(sql` on conflict ${targetSql} do nothing${whereSql}`);
		}
		return this;
	}

Domain

Subdomains

Frequently Asked Questions

What does onConflictDoNothing() do?
onConflictDoNothing() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/sqlite-core/query-builders/insert.ts.
Where is onConflictDoNothing() defined?
onConflictDoNothing() is defined in drizzle-orm/src/sqlite-core/query-builders/insert.ts at line 306.

Analyze Your Own Codebase

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

Try Supermodel Free