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

mysqlIntrospect.ts — drizzle-orm Source File

Architecture documentation for mysqlIntrospect.ts, a typescript file in the drizzle-orm codebase. 9 imports, 0 dependents.

File typescript DrizzleKit CLIWorkflow 9 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  f816063a_7e7e_84b8_d556_2fad92ba1294["mysqlIntrospect.ts"]
  8f03c4cf_4fdf_b056_3b24_d493cab0cc81["global.ts"]
  f816063a_7e7e_84b8_d556_2fad92ba1294 --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  f2ee16c1_40e6_43f3_15b2_c391a3ac170b["mysqlSchema.ts"]
  f816063a_7e7e_84b8_d556_2fad92ba1294 --> f2ee16c1_40e6_43f3_15b2_c391a3ac170b
  1f633f0f_d981_8483_0b8f_fbabf0333ced["mysqlSerializer.ts"]
  f816063a_7e7e_84b8_d556_2fad92ba1294 --> 1f633f0f_d981_8483_0b8f_fbabf0333ced
  5ac9c01c_6690_a9da_65af_5a848a7f5362["fromDatabase"]
  f816063a_7e7e_84b8_d556_2fad92ba1294 --> 5ac9c01c_6690_a9da_65af_5a848a7f5362
  5847e5ae_7b4a_4b02_b68f_883ef88b3c1a["utils.ts"]
  f816063a_7e7e_84b8_d556_2fad92ba1294 --> 5847e5ae_7b4a_4b02_b68f_883ef88b3c1a
  217e2cbd_4fb7_ceab_251c_5733ece08a8f["views.ts"]
  f816063a_7e7e_84b8_d556_2fad92ba1294 --> 217e2cbd_4fb7_ceab_251c_5733ece08a8f
  946a5474_7e86_7977_562a_290de1fdc827["ProgressView"]
  f816063a_7e7e_84b8_d556_2fad92ba1294 --> 946a5474_7e86_7977_562a_290de1fdc827
  a506b568_7d24_7568_35df_af935066e9fd["hanji"]
  f816063a_7e7e_84b8_d556_2fad92ba1294 --> a506b568_7d24_7568_35df_af935066e9fd
  bcba9db4_12fe_4370_dc2c_c82528eb2bb8["minimatch"]
  f816063a_7e7e_84b8_d556_2fad92ba1294 --> bcba9db4_12fe_4370_dc2c_c82528eb2bb8
  style f816063a_7e7e_84b8_d556_2fad92ba1294 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { renderWithTask } from 'hanji';
import { Minimatch } from 'minimatch';
import { originUUID } from '../../global';
import type { MySqlSchema } from '../../serializer/mysqlSchema';
import { fromDatabase } from '../../serializer/mysqlSerializer';
import type { DB } from '../../utils';
import { ProgressView } from '../views';

export const mysqlPushIntrospect = async (
	db: DB,
	databaseName: string,
	filters: string[],
) => {
	const matchers = filters.map((it) => {
		return new Minimatch(it);
	});

	const filter = (tableName: string) => {
		if (matchers.length === 0) return true;

		let flags: boolean[] = [];

		for (let matcher of matchers) {
			if (matcher.negate) {
				if (!matcher.match(tableName)) {
					flags.push(false);
				}
			}

			if (matcher.match(tableName)) {
				flags.push(true);
			}
		}

		if (flags.length > 0) {
			return flags.every(Boolean);
		}
		return false;
	};

	const progress = new ProgressView(
		'Pulling schema from database...',
		'Pulling schema from database...',
	);
	const res = await renderWithTask(
		progress,
		fromDatabase(db, databaseName, filter),
	);

	const schema = { id: originUUID, prevId: '', ...res } as MySqlSchema;
	const { internal, ...schemaWithoutInternals } = schema;
	return { schema: schemaWithoutInternals };
};

Domain

Subdomains

Frequently Asked Questions

What does mysqlIntrospect.ts do?
mysqlIntrospect.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 mysqlIntrospect.ts?
mysqlIntrospect.ts defines 1 function(s): mysqlPushIntrospect.
What does mysqlIntrospect.ts depend on?
mysqlIntrospect.ts imports 9 module(s): ProgressView, fromDatabase, global.ts, hanji, minimatch, mysqlSchema.ts, mysqlSerializer.ts, utils.ts, and 1 more.
Where is mysqlIntrospect.ts in the architecture?
mysqlIntrospect.ts is located at drizzle-kit/src/cli/commands/mysqlIntrospect.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