Home / File/ check.ts — drizzle-orm Source File

check.ts — drizzle-orm Source File

Architecture documentation for check.ts, a typescript file in the drizzle-orm codebase. 5 imports, 1 dependents.

File typescript DrizzleKit CLIWorkflow 5 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  6ea07f83_f4a3_1c2d_2fdd_b14c317bc55d["check.ts"]
  5e835bc2_6860_21e3_492c_babcc3e93529["schemaValidator.ts"]
  6ea07f83_f4a3_1c2d_2fdd_b14c317bc55d --> 5e835bc2_6860_21e3_492c_babcc3e93529
  4984e904_30ec_49a5_c0a0_8a45cd71fe26["Dialect"]
  6ea07f83_f4a3_1c2d_2fdd_b14c317bc55d --> 4984e904_30ec_49a5_c0a0_8a45cd71fe26
  5847e5ae_7b4a_4b02_b68f_883ef88b3c1a["utils.ts"]
  6ea07f83_f4a3_1c2d_2fdd_b14c317bc55d --> 5847e5ae_7b4a_4b02_b68f_883ef88b3c1a
  3f325b6b_14df_fa20_c5d7_83c98bc3d75c["prepareOutFolder"]
  6ea07f83_f4a3_1c2d_2fdd_b14c317bc55d --> 3f325b6b_14df_fa20_c5d7_83c98bc3d75c
  b18145b4_f05d_a9ae_4a8e_98368ec2cf0d["validateWithReport"]
  6ea07f83_f4a3_1c2d_2fdd_b14c317bc55d --> b18145b4_f05d_a9ae_4a8e_98368ec2cf0d
  5bf76609_579e_d312_b33b_ab5b8b683111["schema.ts"]
  5bf76609_579e_d312_b33b_ab5b8b683111 --> 6ea07f83_f4a3_1c2d_2fdd_b14c317bc55d
  style 6ea07f83_f4a3_1c2d_2fdd_b14c317bc55d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { Dialect } from '../../schemaValidator';
import { prepareOutFolder, validateWithReport } from '../../utils';

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

Functions

Frequently Asked Questions

What does check.ts do?
check.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleKit domain, CLIWorkflow subdomain.
What functions are defined in check.ts?
check.ts defines 1 function(s): checkHandler.
What does check.ts depend on?
check.ts imports 5 module(s): Dialect, prepareOutFolder, schemaValidator.ts, utils.ts, validateWithReport.
What files import check.ts?
check.ts is imported by 1 file(s): schema.ts.
Where is check.ts in the architecture?
check.ts is located at drizzle-kit/src/cli/commands/check.ts (domain: DrizzleKit, subdomain: CLIWorkflow, directory: drizzle-kit/src/cli/commands).

Analyze Your Own Codebase

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

Try Supermodel Free