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

index.ts — drizzle-orm Source File

Architecture documentation for index.ts, a typescript file in the drizzle-orm codebase. 12 imports, 2 dependents.

File typescript DrizzleKit SnapshotSerializer 12 imports 2 dependents 5 functions

Entity Profile

Dependency Diagram

graph LR
  c3eb904f_5390_9c0d_4b12_54d182c5f8c9["index.ts"]
  217e2cbd_4fb7_ceab_251c_5733ece08a8f["views.ts"]
  c3eb904f_5390_9c0d_4b12_54d182c5f8c9 --> 217e2cbd_4fb7_ceab_251c_5733ece08a8f
  b0ef3d06_896b_eefc_c410_dfb419673d70["error"]
  c3eb904f_5390_9c0d_4b12_54d182c5f8c9 --> b0ef3d06_896b_eefc_c410_dfb419673d70
  f2ee16c1_40e6_43f3_15b2_c391a3ac170b["mysqlSchema.ts"]
  c3eb904f_5390_9c0d_4b12_54d182c5f8c9 --> f2ee16c1_40e6_43f3_15b2_c391a3ac170b
  cbf63853_6723_30fc_5ded_88a8944f77c4["pgSchema.ts"]
  c3eb904f_5390_9c0d_4b12_54d182c5f8c9 --> cbf63853_6723_30fc_5ded_88a8944f77c4
  d63c81a6_6779_4926_bffe_7351e12a4301["singlestoreSchema.ts"]
  c3eb904f_5390_9c0d_4b12_54d182c5f8c9 --> d63c81a6_6779_4926_bffe_7351e12a4301
  4544b292_3be6_3d5c_dcf4_cfb560ea3b61["SingleStoreSchemaInternal"]
  c3eb904f_5390_9c0d_4b12_54d182c5f8c9 --> 4544b292_3be6_3d5c_dcf4_cfb560ea3b61
  03c276d3_0efe_66e2_9ba9_e67edbf29418["sqliteSchema.ts"]
  c3eb904f_5390_9c0d_4b12_54d182c5f8c9 --> 03c276d3_0efe_66e2_9ba9_e67edbf29418
  0f00c7dd_5eba_f1f8_c559_a99431086500["chalk"]
  c3eb904f_5390_9c0d_4b12_54d182c5f8c9 --> 0f00c7dd_5eba_f1f8_c559_a99431086500
  9a46d98d_eb2d_c1e4_a37b_506dd514a6a7["fs"]
  c3eb904f_5390_9c0d_4b12_54d182c5f8c9 --> 9a46d98d_eb2d_c1e4_a37b_506dd514a6a7
  de3de3cc_a6ee_d613_6500_5a1907908a06["glob"]
  c3eb904f_5390_9c0d_4b12_54d182c5f8c9 --> de3de3cc_a6ee_d613_6500_5a1907908a06
  412eac48_6e13_8b0f_b7b2_5c943c225130["path"]
  c3eb904f_5390_9c0d_4b12_54d182c5f8c9 --> 412eac48_6e13_8b0f_b7b2_5c943c225130
  69eb5c6a_1f39_88ff_23e8_06dadec35df5["common"]
  c3eb904f_5390_9c0d_4b12_54d182c5f8c9 --> 69eb5c6a_1f39_88ff_23e8_06dadec35df5
  09e5bcf1_0f03_3dbd_fbdb_762440f28855["utils.ts"]
  09e5bcf1_0f03_3dbd_fbdb_762440f28855 --> c3eb904f_5390_9c0d_4b12_54d182c5f8c9
  4078709f_3fc0_5514_7728_8f28a7b0e807["migrationPreparator.ts"]
  4078709f_3fc0_5514_7728_8f28a7b0e807 --> c3eb904f_5390_9c0d_4b12_54d182c5f8c9
  style c3eb904f_5390_9c0d_4b12_54d182c5f8c9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import chalk from 'chalk';
import fs from 'fs';
import * as glob from 'glob';
import Path from 'path';
import { CasingType } from 'src/cli/validations/common';
import { error } from '../cli/views';
import type { MySqlSchemaInternal } from './mysqlSchema';
import type { PgSchemaInternal } from './pgSchema';
import { SingleStoreSchemaInternal } from './singlestoreSchema';
import type { SQLiteSchemaInternal } from './sqliteSchema';

export const serializeMySql = async (
	path: string | string[],
	casing: CasingType | undefined,
): Promise<MySqlSchemaInternal> => {
	const filenames = prepareFilenames(path);

	console.log(chalk.gray(`Reading schema files:\n${filenames.join('\n')}\n`));

	const { prepareFromMySqlImports } = await import('./mysqlImports');
	const { generateMySqlSnapshot } = await import('./mysqlSerializer');

	const { tables, views } = await prepareFromMySqlImports(filenames);

	return generateMySqlSnapshot(tables, views, casing);
};

export const serializePg = async (
	path: string | string[],
	casing: CasingType | undefined,
	schemaFilter?: string[],
): Promise<PgSchemaInternal> => {
	const filenames = prepareFilenames(path);

	const { prepareFromPgImports } = await import('./pgImports');
	const { generatePgSnapshot } = await import('./pgSerializer');

	const { tables, enums, schemas, sequences, views, matViews, roles, policies } = await prepareFromPgImports(
		filenames,
	);

	return generatePgSnapshot(tables, enums, schemas, sequences, roles, policies, views, matViews, casing, schemaFilter);
};

export const serializeSQLite = async (
	path: string | string[],
	casing: CasingType | undefined,
): Promise<SQLiteSchemaInternal> => {
	const filenames = prepareFilenames(path);

	const { prepareFromSqliteImports } = await import('./sqliteImports');
	const { generateSqliteSnapshot } = await import('./sqliteSerializer');
	const { tables, views } = await prepareFromSqliteImports(filenames);
	return generateSqliteSnapshot(tables, views, casing);
};

export const serializeSingleStore = async (
	path: string | string[],
	casing: CasingType | undefined,
): Promise<SingleStoreSchemaInternal> => {
// ... (71 more lines)

Domain

Subdomains

Frequently Asked Questions

What does index.ts do?
index.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 index.ts?
index.ts defines 5 function(s): prepareFilenames, serializeMySql, serializePg, serializeSQLite, serializeSingleStore.
What does index.ts depend on?
index.ts imports 12 module(s): SingleStoreSchemaInternal, chalk, common, error, fs, glob, mysqlSchema.ts, path, and 4 more.
What files import index.ts?
index.ts is imported by 2 file(s): migrationPreparator.ts, utils.ts.
Where is index.ts in the architecture?
index.ts is located at drizzle-kit/src/serializer/index.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