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

introspect-mysql.ts — drizzle-orm Source File

Architecture documentation for introspect-mysql.ts, a typescript file in the drizzle-orm codebase. 16 imports, 1 dependents.

File typescript DrizzleKit Introspection 16 imports 1 dependents 19 functions

Entity Profile

Dependency Diagram

graph LR
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa["introspect-mysql.ts"]
  036f4e7e_88ec_1167_0cc5_711786d91440["utils.ts"]
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa --> 036f4e7e_88ec_1167_0cc5_711786d91440
  9135e6b6_37f7_c980_ee35_90f5531de5a4["common.ts"]
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa --> 9135e6b6_37f7_c980_ee35_90f5531de5a4
  8f03c4cf_4fdf_b056_3b24_d493cab0cc81["global.ts"]
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  071bfc71_ad06_c0c4_cba2_360298dd4b47["assertUnreachable"]
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa --> 071bfc71_ad06_c0c4_cba2_360298dd4b47
  f2ee16c1_40e6_43f3_15b2_c391a3ac170b["mysqlSchema.ts"]
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa --> f2ee16c1_40e6_43f3_15b2_c391a3ac170b
  db1af279_1679_84af_1e53_0bb821c5aa1e["CheckConstraint"]
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa --> db1af279_1679_84af_1e53_0bb821c5aa1e
  2c8e6825_d659_16ea_af7a_522f31b91540["Column"]
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa --> 2c8e6825_d659_16ea_af7a_522f31b91540
  ad771e19_00c1_26c8_c5f8_3edc0c623fea["ForeignKey"]
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa --> ad771e19_00c1_26c8_c5f8_3edc0c623fea
  64501bef_09a5_1e94_0e0a_15a28262db02["Index"]
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa --> 64501bef_09a5_1e94_0e0a_15a28262db02
  b8ffbc78_4812_3db2_2657_70d0793f7d8e["MySqlSchema"]
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa --> b8ffbc78_4812_3db2_2657_70d0793f7d8e
  4dfa8fd0_46f4_3013_c18d_b486cff13b75["MySqlSchemaInternal"]
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa --> 4dfa8fd0_46f4_3013_c18d_b486cff13b75
  84587d26_b8cd_b303_0593_3f9c9b051e01["PrimaryKey"]
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa --> 84587d26_b8cd_b303_0593_3f9c9b051e01
  f304fca3_008f_3fcc_5958_8d6c00dd13e6["UniqueConstraint"]
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa --> f304fca3_008f_3fcc_5958_8d6c00dd13e6
  5847e5ae_7b4a_4b02_b68f_883ef88b3c1a["utils.ts"]
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa --> 5847e5ae_7b4a_4b02_b68f_883ef88b3c1a
  style 1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/* eslint-disable @typescript-eslint/no-unsafe-argument */
import { toCamelCase } from 'drizzle-orm/casing';
import './@types/utils';
import type { Casing } from './cli/validations/common';
import { assertUnreachable } from './global';
import {
	CheckConstraint,
	Column,
	ForeignKey,
	Index,
	MySqlSchema,
	MySqlSchemaInternal,
	PrimaryKey,
	UniqueConstraint,
} from './serializer/mysqlSchema';
import { unescapeSingleQuotes } from './utils';

const mysqlImportsList = new Set([
	'mysqlTable',
	'mysqlEnum',
	'bigint',
	'binary',
	'boolean',
	'char',
	'date',
	'datetime',
	'decimal',
	'double',
	'float',
	'int',
	'json',
	'mediumint',
	'real',
	'serial',
	'smallint',
	'text',
	'tinytext',
	'mediumtext',
	'longtext',
	'time',
	'timestamp',
	'tinyint',
	'varbinary',
	'varchar',
	'year',
	'enum',
]);

const objToStatement = (json: any) => {
	json = Object.fromEntries(Object.entries(json).filter((it) => it[1]));

	const keys = Object.keys(json);
	if (keys.length === 0) return;

	let statement = '{ ';
	statement += keys.map((it) => `"${it}": "${json[it]}"`).join(', ');
	statement += ' }';
	return statement;
};

// ... (971 more lines)

Domain

Subdomains

Frequently Asked Questions

What does introspect-mysql.ts do?
introspect-mysql.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleKit domain, Introspection subdomain.
What functions are defined in introspect-mysql.ts?
introspect-mysql.ts defines 19 function(s): binaryConfig, column, createTableChecks, createTableColumns, createTableFKs, createTableIndexes, createTablePKs, createTableUniques, dbColumnName, escapeColumnKey, and 9 more.
What does introspect-mysql.ts depend on?
introspect-mysql.ts imports 16 module(s): CheckConstraint, Column, ForeignKey, Index, MySqlSchema, MySqlSchemaInternal, PrimaryKey, UniqueConstraint, and 8 more.
What files import introspect-mysql.ts?
introspect-mysql.ts is imported by 1 file(s): introspect.ts.
Where is introspect-mysql.ts in the architecture?
introspect-mysql.ts is located at drizzle-kit/src/introspect-mysql.ts (domain: DrizzleKit, subdomain: Introspection, directory: drizzle-kit/src).

Analyze Your Own Codebase

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

Try Supermodel Free