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

mysqlSchema.ts — drizzle-orm Source File

Architecture documentation for mysqlSchema.ts, a typescript file in the drizzle-orm codebase. 3 imports, 16 dependents.

File typescript DrizzleKit SnapshotSerializer 3 imports 16 dependents 14 functions

Entity Profile

Dependency Diagram

graph LR
  f2ee16c1_40e6_43f3_15b2_c391a3ac170b["mysqlSchema.ts"]
  8f03c4cf_4fdf_b056_3b24_d493cab0cc81["global.ts"]
  f2ee16c1_40e6_43f3_15b2_c391a3ac170b --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  920ff56d_9b78_d6a4_9c81_c1e6a3d1d992["mapValues"]
  f2ee16c1_40e6_43f3_15b2_c391a3ac170b --> 920ff56d_9b78_d6a4_9c81_c1e6a3d1d992
  9d8cc145_835b_8147_2ea5_b7b5383ae775["zod"]
  f2ee16c1_40e6_43f3_15b2_c391a3ac170b --> 9d8cc145_835b_8147_2ea5_b7b5383ae775
  e668bfef_9125_1ef0_2f94_a0f9605584bd["api.ts"]
  e668bfef_9125_1ef0_2f94_a0f9605584bd --> f2ee16c1_40e6_43f3_15b2_c391a3ac170b
  c2c22050_0d5c_404e_2b18_5934c728a89c["introspect.ts"]
  c2c22050_0d5c_404e_2b18_5934c728a89c --> f2ee16c1_40e6_43f3_15b2_c391a3ac170b
  b14d3855_8cce_38c9_8952_a9d014c2fb1b["migrate.ts"]
  b14d3855_8cce_38c9_8952_a9d014c2fb1b --> f2ee16c1_40e6_43f3_15b2_c391a3ac170b
  f816063a_7e7e_84b8_d556_2fad92ba1294["mysqlIntrospect.ts"]
  f816063a_7e7e_84b8_d556_2fad92ba1294 --> f2ee16c1_40e6_43f3_15b2_c391a3ac170b
  b387f7cb_f080_cc3a_a94d_1e2775ef2400["mysqlPushUtils.ts"]
  b387f7cb_f080_cc3a_a94d_1e2775ef2400 --> f2ee16c1_40e6_43f3_15b2_c391a3ac170b
  290757cc_8ec0_769b_cd24_8074fcebc663["mysqlUp.ts"]
  290757cc_8ec0_769b_cd24_8074fcebc663 --> f2ee16c1_40e6_43f3_15b2_c391a3ac170b
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa["introspect-mysql.ts"]
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa --> f2ee16c1_40e6_43f3_15b2_c391a3ac170b
  c1c349dd_2e31_d056_728c_c034cebb41c0["introspect-sqlite.ts"]
  c1c349dd_2e31_d056_728c_c034cebb41c0 --> f2ee16c1_40e6_43f3_15b2_c391a3ac170b
  6139f734_8ada_c641_9fec_9a55cfdf376f["jsonStatements.ts"]
  6139f734_8ada_c641_9fec_9a55cfdf376f --> f2ee16c1_40e6_43f3_15b2_c391a3ac170b
  4078709f_3fc0_5514_7728_8f28a7b0e807["migrationPreparator.ts"]
  4078709f_3fc0_5514_7728_8f28a7b0e807 --> f2ee16c1_40e6_43f3_15b2_c391a3ac170b
  5e835bc2_6860_21e3_492c_babcc3e93529["schemaValidator.ts"]
  5e835bc2_6860_21e3_492c_babcc3e93529 --> f2ee16c1_40e6_43f3_15b2_c391a3ac170b
  style f2ee16c1_40e6_43f3_15b2_c391a3ac170b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { any, boolean, enum as enumType, literal, object, record, string, TypeOf, union } from 'zod';
import { mapValues, originUUID } from '../global';

// ------- V3 --------
const index = object({
	name: string(),
	columns: string().array(),
	isUnique: boolean(),
	using: enumType(['btree', 'hash']).optional(),
	algorithm: enumType(['default', 'inplace', 'copy']).optional(),
	lock: enumType(['default', 'none', 'shared', 'exclusive']).optional(),
}).strict();

const fk = object({
	name: string(),
	tableFrom: string(),
	columnsFrom: string().array(),
	tableTo: string(),
	columnsTo: string().array(),
	onUpdate: string().optional(),
	onDelete: string().optional(),
}).strict();

const column = object({
	name: string(),
	type: string(),
	primaryKey: boolean(),
	notNull: boolean(),
	autoincrement: boolean().optional(),
	default: any().optional(),
	onUpdate: any().optional(),
	generated: object({
		type: enumType(['stored', 'virtual']),
		as: string(),
	}).optional(),
}).strict();

const tableV3 = object({
	name: string(),
	columns: record(string(), column),
	indexes: record(string(), index),
	foreignKeys: record(string(), fk),
}).strict();

const compositePK = object({
	name: string(),
	columns: string().array(),
}).strict();

const uniqueConstraint = object({
	name: string(),
	columns: string().array(),
}).strict();

const checkConstraint = object({
	name: string(),
	value: string(),
}).strict();

const tableV4 = object({
// ... (364 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does mysqlSchema.ts do?
mysqlSchema.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleKit domain, SnapshotSerializer subdomain.
What functions are defined in mysqlSchema.ts?
mysqlSchema.ts defines 14 function(s): MySqlSquasher.squashCheck, MySqlSquasher.squashFK, MySqlSquasher.squashIdx, MySqlSquasher.squashPK, MySqlSquasher.squashUnique, MySqlSquasher.squashView, MySqlSquasher.unsquashCheck, MySqlSquasher.unsquashFK, MySqlSquasher.unsquashIdx, MySqlSquasher.unsquashPK, and 4 more.
What does mysqlSchema.ts depend on?
mysqlSchema.ts imports 3 module(s): global.ts, mapValues, zod.
What files import mysqlSchema.ts?
mysqlSchema.ts is imported by 16 file(s): api.ts, index.ts, introspect-mysql.ts, introspect-sqlite.ts, introspect.ts, jsonStatements.ts, migrate.ts, migrationPreparator.ts, and 8 more.
Where is mysqlSchema.ts in the architecture?
mysqlSchema.ts is located at drizzle-kit/src/serializer/mysqlSchema.ts (domain: DrizzleKit, subdomain: SnapshotSerializer, directory: drizzle-kit/src/serializer).

Analyze Your Own Codebase

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

Try Supermodel Free