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

sqliteSerializer.ts — drizzle-orm Source File

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

File typescript DrizzleKit SnapshotSerializer 12 imports 3 dependents 5 functions

Entity Profile

Dependency Diagram

graph LR
  8e6879a2_2b61_04aa_8765_25bc6cfe77be["sqliteSerializer.ts"]
  502fb53b_89d2_ec40_3a24_f05850833f68["outputs.ts"]
  8e6879a2_2b61_04aa_8765_25bc6cfe77be --> 502fb53b_89d2_ec40_3a24_f05850833f68
  217e2cbd_4fb7_ceab_251c_5733ece08a8f["views.ts"]
  8e6879a2_2b61_04aa_8765_25bc6cfe77be --> 217e2cbd_4fb7_ceab_251c_5733ece08a8f
  03c276d3_0efe_66e2_9ba9_e67edbf29418["sqliteSchema.ts"]
  8e6879a2_2b61_04aa_8765_25bc6cfe77be --> 03c276d3_0efe_66e2_9ba9_e67edbf29418
  5847e5ae_7b4a_4b02_b68f_883ef88b3c1a["utils.ts"]
  8e6879a2_2b61_04aa_8765_25bc6cfe77be --> 5847e5ae_7b4a_4b02_b68f_883ef88b3c1a
  6a0cfd17_5e20_42bb_3596_ae02093b0fda["escapeSingleQuotes"]
  8e6879a2_2b61_04aa_8765_25bc6cfe77be --> 6a0cfd17_5e20_42bb_3596_ae02093b0fda
  12d176aa_882f_ddcb_4bc8_df3fbb9542b1["utils.ts"]
  8e6879a2_2b61_04aa_8765_25bc6cfe77be --> 12d176aa_882f_ddcb_4bc8_df3fbb9542b1
  0f6bcec9_496e_3388_a2d6_2f3af1e12d53["getColumnCasing"]
  8e6879a2_2b61_04aa_8765_25bc6cfe77be --> 0f6bcec9_496e_3388_a2d6_2f3af1e12d53
  5de2ec9b_64d7_f004_04c1_e08f9695c862["sqlToStr"]
  8e6879a2_2b61_04aa_8765_25bc6cfe77be --> 5de2ec9b_64d7_f004_04c1_e08f9695c862
  0f00c7dd_5eba_f1f8_c559_a99431086500["chalk"]
  8e6879a2_2b61_04aa_8765_25bc6cfe77be --> 0f00c7dd_5eba_f1f8_c559_a99431086500
  690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"]
  8e6879a2_2b61_04aa_8765_25bc6cfe77be --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031
  25248a9d_ba06_2b33_4421_8575da2f9c34["sqlite-core"]
  8e6879a2_2b61_04aa_8765_25bc6cfe77be --> 25248a9d_ba06_2b33_4421_8575da2f9c34
  69eb5c6a_1f39_88ff_23e8_06dadec35df5["common"]
  8e6879a2_2b61_04aa_8765_25bc6cfe77be --> 69eb5c6a_1f39_88ff_23e8_06dadec35df5
  e668bfef_9125_1ef0_2f94_a0f9605584bd["api.ts"]
  e668bfef_9125_1ef0_2f94_a0f9605584bd --> 8e6879a2_2b61_04aa_8765_25bc6cfe77be
  c2c22050_0d5c_404e_2b18_5934c728a89c["introspect.ts"]
  c2c22050_0d5c_404e_2b18_5934c728a89c --> 8e6879a2_2b61_04aa_8765_25bc6cfe77be
  style 8e6879a2_2b61_04aa_8765_25bc6cfe77be fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import chalk from 'chalk';
import { getTableName, is, SQL } from 'drizzle-orm';
import {
	AnySQLiteTable,
	getTableConfig,
	getViewConfig,
	SQLiteBaseInteger,
	SQLiteColumn,
	SQLiteSyncDialect,
	SQLiteView,
	uniqueKeyName,
} from 'drizzle-orm/sqlite-core';
import { CasingType } from 'src/cli/validations/common';
import { withStyle } from '../cli/validations/outputs';
import type { IntrospectStage, IntrospectStatus } from '../cli/views';
import type {
	CheckConstraint,
	Column,
	ForeignKey,
	Index,
	PrimaryKey,
	SQLiteKitInternals,
	SQLiteSchemaInternal,
	Table,
	UniqueConstraint,
	View,
} from '../serializer/sqliteSchema';
import { escapeSingleQuotes, type SQLiteDB } from '../utils';
import { getColumnCasing, sqlToStr } from './utils';

export const generateSqliteSnapshot = (
	tables: AnySQLiteTable[],
	views: SQLiteView[],
	casing: CasingType | undefined,
): SQLiteSchemaInternal => {
	const dialect = new SQLiteSyncDialect({ casing });
	const result: Record<string, Table> = {};
	const resultViews: Record<string, View> = {};

	const internal: SQLiteKitInternals = { indexes: {} };
	for (const table of tables) {
		// const tableName = getTableName(table);
		const columnsObject: Record<string, Column> = {};
		const indexesObject: Record<string, Index> = {};
		const foreignKeysObject: Record<string, ForeignKey> = {};
		const primaryKeysObject: Record<string, PrimaryKey> = {};
		const uniqueConstraintObject: Record<string, UniqueConstraint> = {};
		const checkConstraintObject: Record<string, CheckConstraint> = {};

		const checksInTable: Record<string, string[]> = {};

		const {
			name: tableName,
			columns,
			indexes,
			checks,
			foreignKeys: tableForeignKeys,
			primaryKeys,
			uniqueConstraints,
		} = getTableConfig(table);
// ... (894 more lines)

Domain

Subdomains

Types

Frequently Asked Questions

What does sqliteSerializer.ts do?
sqliteSerializer.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 sqliteSerializer.ts?
sqliteSerializer.ts defines 5 function(s): extractGeneratedColumns, filterIgnoredTablesByField, fromDatabase, generateSqliteSnapshot, mapSqlToSqliteType.
What does sqliteSerializer.ts depend on?
sqliteSerializer.ts imports 12 module(s): chalk, common, drizzle-orm, escapeSingleQuotes, getColumnCasing, outputs.ts, sqlToStr, sqlite-core, and 4 more.
What files import sqliteSerializer.ts?
sqliteSerializer.ts is imported by 3 file(s): api.ts, introspect.ts, sqliteIntrospect.ts.
Where is sqliteSerializer.ts in the architecture?
sqliteSerializer.ts is located at drizzle-kit/src/serializer/sqliteSerializer.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