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

mysql.ts — drizzle-orm Source File

Architecture documentation for mysql.ts, a typescript file in the drizzle-orm codebase. 6 imports, 7 dependents.

File typescript DrizzleKit CLIWorkflow 6 imports 7 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  d81f4f07_7d2c_ea3f_392e_6be6055ba361["mysql.ts"]
  217e2cbd_4fb7_ceab_251c_5733ece08a8f["views.ts"]
  d81f4f07_7d2c_ea3f_392e_6be6055ba361 --> 217e2cbd_4fb7_ceab_251c_5733ece08a8f
  b0ef3d06_896b_eefc_c410_dfb419673d70["error"]
  d81f4f07_7d2c_ea3f_392e_6be6055ba361 --> b0ef3d06_896b_eefc_c410_dfb419673d70
  9135e6b6_37f7_c980_ee35_90f5531de5a4["common.ts"]
  d81f4f07_7d2c_ea3f_392e_6be6055ba361 --> 9135e6b6_37f7_c980_ee35_90f5531de5a4
  b00190f0_9c7c_acbf_86f7_950ac8c79592["wrapParam"]
  d81f4f07_7d2c_ea3f_392e_6be6055ba361 --> b00190f0_9c7c_acbf_86f7_950ac8c79592
  502fb53b_89d2_ec40_3a24_f05850833f68["outputs.ts"]
  d81f4f07_7d2c_ea3f_392e_6be6055ba361 --> 502fb53b_89d2_ec40_3a24_f05850833f68
  9d8cc145_835b_8147_2ea5_b7b5383ae775["zod"]
  d81f4f07_7d2c_ea3f_392e_6be6055ba361 --> 9d8cc145_835b_8147_2ea5_b7b5383ae775
  e668bfef_9125_1ef0_2f94_a0f9605584bd["api.ts"]
  e668bfef_9125_1ef0_2f94_a0f9605584bd --> d81f4f07_7d2c_ea3f_392e_6be6055ba361
  c2c22050_0d5c_404e_2b18_5934c728a89c["introspect.ts"]
  c2c22050_0d5c_404e_2b18_5934c728a89c --> d81f4f07_7d2c_ea3f_392e_6be6055ba361
  6219550e_1686_ca7a_0d96_0838fb90e7cb["push.ts"]
  6219550e_1686_ca7a_0d96_0838fb90e7cb --> d81f4f07_7d2c_ea3f_392e_6be6055ba361
  09e5bcf1_0f03_3dbd_fbdb_762440f28855["utils.ts"]
  09e5bcf1_0f03_3dbd_fbdb_762440f28855 --> d81f4f07_7d2c_ea3f_392e_6be6055ba361
  4e02c2bb_54a8_1500_813e_2cafd1ad4f59["connections.ts"]
  4e02c2bb_54a8_1500_813e_2cafd1ad4f59 --> d81f4f07_7d2c_ea3f_392e_6be6055ba361
  b30392fa_f107_a197_96c4_0d1a6ce594a2["studio.ts"]
  b30392fa_f107_a197_96c4_0d1a6ce594a2 --> d81f4f07_7d2c_ea3f_392e_6be6055ba361
  82de12f8_a8ca_9d38_8da8_9ac945d81e01["studio.ts"]
  82de12f8_a8ca_9d38_8da8_9ac945d81e01 --> d81f4f07_7d2c_ea3f_392e_6be6055ba361
  style d81f4f07_7d2c_ea3f_392e_6be6055ba361 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { boolean, coerce, object, string, TypeOf, union } from 'zod';
import { error } from '../views';
import { wrapParam } from './common';
import { outputs } from './outputs';

export const mysqlCredentials = union([
	object({
		host: string().min(1),
		port: coerce.number().min(1).optional(),
		user: string().min(1).optional(),
		password: string().min(1).optional(),
		database: string().min(1),
		ssl: union([
			string(),
			object({
				pfx: string().optional(),
				key: string().optional(),
				passphrase: string().optional(),
				cert: string().optional(),
				ca: union([string(), string().array()]).optional(),
				crl: union([string(), string().array()]).optional(),
				ciphers: string().optional(),
				rejectUnauthorized: boolean().optional(),
			}),
		]).optional(),
	}),
	object({
		url: string().min(1),
	}),
]);

export type MysqlCredentials = TypeOf<typeof mysqlCredentials>;

export const printCliConnectionIssues = (options: any) => {
	const { uri, host, database } = options || {};

	if (!uri && (!host || !database)) {
		console.log(outputs.mysql.connection.required());
	}
};

export const printConfigConnectionIssues = (
	options: Record<string, unknown>,
) => {
	if ('url' in options) {
		let text = `Please provide required params for MySQL driver:\n`;
		console.log(error(text));
		console.log(wrapParam('url', options.url, false, 'url'));
		process.exit(1);
	}

	let text = `Please provide required params for MySQL driver:\n`;
	console.log(error(text));
	console.log(wrapParam('host', options.host));
	console.log(wrapParam('port', options.port, true));
	console.log(wrapParam('user', options.user, true));
	console.log(wrapParam('password', options.password, true, 'secret'));
	console.log(wrapParam('database', options.database));
	console.log(wrapParam('ssl', options.ssl, true));
	process.exit(1);
};

Domain

Subdomains

Frequently Asked Questions

What does mysql.ts do?
mysql.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 mysql.ts?
mysql.ts defines 2 function(s): printCliConnectionIssues, printConfigConnectionIssues.
What does mysql.ts depend on?
mysql.ts imports 6 module(s): common.ts, error, outputs.ts, views.ts, wrapParam, zod.
What files import mysql.ts?
mysql.ts is imported by 7 file(s): api.ts, connections.ts, introspect.ts, push.ts, studio.ts, studio.ts, utils.ts.
Where is mysql.ts in the architecture?
mysql.ts is located at drizzle-kit/src/cli/validations/mysql.ts (domain: DrizzleKit, subdomain: CLIWorkflow, directory: drizzle-kit/src/cli/validations).

Analyze Your Own Codebase

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

Try Supermodel Free