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

update1to2() — drizzle-orm Function Reference

Architecture documentation for the update1to2() function in jsonDiffer.js from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  6129fa98_a762_8fb0_62ea_f5c254aea09e["update1to2()"]
  42cd5bcb_caa4_6b61_11ea_da1b767eeadd["jsonDiffer.js"]
  6129fa98_a762_8fb0_62ea_f5c254aea09e -->|defined in| 42cd5bcb_caa4_6b61_11ea_da1b767eeadd
  style 6129fa98_a762_8fb0_62ea_f5c254aea09e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/jsonDiffer.js lines 37–54

const update1to2 = (json) => {
	Object.entries(json).forEach(([key, val]) => {
		if ('object' !== typeof val) return;

		if (val.hasOwnProperty('references')) {
			const ref = val['references'];
			const fkName = ref['foreignKeyName'];
			const table = ref['table'];
			const column = ref['column'];
			const onDelete = ref['onDelete'];
			const onUpdate = ref['onUpdate'];
			const newRef = `${fkName};${table};${column};${onDelete ?? ''};${onUpdate ?? ''}`;
			val['references'] = newRef;
		} else {
			update1to2(val);
		}
	});
};

Domain

Subdomains

Frequently Asked Questions

What does update1to2() do?
update1to2() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/jsonDiffer.js.
Where is update1to2() defined?
update1to2() is defined in drizzle-kit/src/jsonDiffer.js at line 37.

Analyze Your Own Codebase

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

Try Supermodel Free