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

checkHandler() — drizzle-orm Function Reference

Architecture documentation for the checkHandler() function in check.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  3082c777_0c92_ea57_9752_a40713e25ea2["checkHandler()"]
  6ea07f83_f4a3_1c2d_2fdd_b14c317bc55d["check.ts"]
  3082c777_0c92_ea57_9752_a40713e25ea2 -->|defined in| 6ea07f83_f4a3_1c2d_2fdd_b14c317bc55d
  4a3d6850_58bb_1641_243e_7435c439d362["check.handler()"]
  4a3d6850_58bb_1641_243e_7435c439d362 -->|calls| 3082c777_0c92_ea57_9752_a40713e25ea2
  3f325b6b_14df_fa20_c5d7_83c98bc3d75c["prepareOutFolder()"]
  3082c777_0c92_ea57_9752_a40713e25ea2 -->|calls| 3f325b6b_14df_fa20_c5d7_83c98bc3d75c
  b18145b4_f05d_a9ae_4a8e_98368ec2cf0d["validateWithReport()"]
  3082c777_0c92_ea57_9752_a40713e25ea2 -->|calls| b18145b4_f05d_a9ae_4a8e_98368ec2cf0d
  style 3082c777_0c92_ea57_9752_a40713e25ea2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/cli/commands/check.ts lines 4–52

export const checkHandler = (out: string, dialect: Dialect) => {
	const { snapshots } = prepareOutFolder(out, dialect);
	const report = validateWithReport(snapshots, dialect);

	if (report.nonLatest.length > 0) {
		console.log(
			report.nonLatest
				.map((it) => {
					return `${it} is not of the latest version, please run "drizzle-kit up"`;
				})
				.join('\n'),
		);
		process.exit(1);
	}

	if (report.malformed.length) {
		const message = report.malformed
			.map((it) => {
				return `${it} data is malformed`;
			})
			.join('\n');
		console.log(message);
	}

	const collisionEntries = Object.entries(report.idsMap).filter(
		(it) => it[1].snapshots.length > 1,
	);

	const message = collisionEntries
		.map((it) => {
			const data = it[1];
			return `[${
				data.snapshots.join(
					', ',
				)
			}] are pointing to a parent snapshot: ${data.parent}/snapshot.json which is a collision.`;
		})
		.join('\n');

	if (message) {
		console.log(message);
	}

	const abort = report.malformed.length!! || collisionEntries.length > 0;

	if (abort) {
		process.exit(1);
	}
};

Domain

Subdomains

Called By

Frequently Asked Questions

What does checkHandler() do?
checkHandler() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/cli/commands/check.ts.
Where is checkHandler() defined?
checkHandler() is defined in drizzle-kit/src/cli/commands/check.ts at line 4.
What does checkHandler() call?
checkHandler() calls 2 function(s): prepareOutFolder, validateWithReport.
What calls checkHandler()?
checkHandler() is called by 1 function(s): check.handler.

Analyze Your Own Codebase

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

Try Supermodel Free