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

pgSchema.ts — drizzle-orm Source File

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

File typescript DrizzleKit SnapshotSerializer 3 imports 15 dependents 21 functions

Entity Profile

Dependency Diagram

graph LR
  cbf63853_6723_30fc_5ded_88a8944f77c4["pgSchema.ts"]
  8f03c4cf_4fdf_b056_3b24_d493cab0cc81["global.ts"]
  cbf63853_6723_30fc_5ded_88a8944f77c4 --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  920ff56d_9b78_d6a4_9c81_c1e6a3d1d992["mapValues"]
  cbf63853_6723_30fc_5ded_88a8944f77c4 --> 920ff56d_9b78_d6a4_9c81_c1e6a3d1d992
  9d8cc145_835b_8147_2ea5_b7b5383ae775["zod"]
  cbf63853_6723_30fc_5ded_88a8944f77c4 --> 9d8cc145_835b_8147_2ea5_b7b5383ae775
  e668bfef_9125_1ef0_2f94_a0f9605584bd["api.ts"]
  e668bfef_9125_1ef0_2f94_a0f9605584bd --> cbf63853_6723_30fc_5ded_88a8944f77c4
  c2c22050_0d5c_404e_2b18_5934c728a89c["introspect.ts"]
  c2c22050_0d5c_404e_2b18_5934c728a89c --> cbf63853_6723_30fc_5ded_88a8944f77c4
  b14d3855_8cce_38c9_8952_a9d014c2fb1b["migrate.ts"]
  b14d3855_8cce_38c9_8952_a9d014c2fb1b --> cbf63853_6723_30fc_5ded_88a8944f77c4
  9b24aa9e_af00_88e2_5a0a_d67a2b0b670c["pgIntrospect.ts"]
  9b24aa9e_af00_88e2_5a0a_d67a2b0b670c --> cbf63853_6723_30fc_5ded_88a8944f77c4
  1f0f6821_4b66_fcbb_186f_e1b78872b924["pgPushUtils.ts"]
  1f0f6821_4b66_fcbb_186f_e1b78872b924 --> cbf63853_6723_30fc_5ded_88a8944f77c4
  466af62c_27ae_41b6_d841_1dc8334565a4["pgUp.ts"]
  466af62c_27ae_41b6_d841_1dc8334565a4 --> cbf63853_6723_30fc_5ded_88a8944f77c4
  71516551_23e3_bf30_27c9_000fb046ef71["introspect-pg.ts"]
  71516551_23e3_bf30_27c9_000fb046ef71 --> cbf63853_6723_30fc_5ded_88a8944f77c4
  6139f734_8ada_c641_9fec_9a55cfdf376f["jsonStatements.ts"]
  6139f734_8ada_c641_9fec_9a55cfdf376f --> cbf63853_6723_30fc_5ded_88a8944f77c4
  4078709f_3fc0_5514_7728_8f28a7b0e807["migrationPreparator.ts"]
  4078709f_3fc0_5514_7728_8f28a7b0e807 --> cbf63853_6723_30fc_5ded_88a8944f77c4
  5e835bc2_6860_21e3_492c_babcc3e93529["schemaValidator.ts"]
  5e835bc2_6860_21e3_492c_babcc3e93529 --> cbf63853_6723_30fc_5ded_88a8944f77c4
  c3eb904f_5390_9c0d_4b12_54d182c5f8c9["index.ts"]
  c3eb904f_5390_9c0d_4b12_54d182c5f8c9 --> cbf63853_6723_30fc_5ded_88a8944f77c4
  style cbf63853_6723_30fc_5ded_88a8944f77c4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { mapValues, originUUID, snapshotVersion } from '../global';

import { any, array, boolean, enum as enumType, literal, number, object, record, string, TypeOf, union } from 'zod';

const indexV2 = object({
	name: string(),
	columns: record(
		string(),
		object({
			name: string(),
		}),
	),
	isUnique: boolean(),
}).strict();

const columnV2 = object({
	name: string(),
	type: string(),
	primaryKey: boolean(),
	notNull: boolean(),
	default: any().optional(),
	references: string().optional(),
}).strict();

const tableV2 = object({
	name: string(),
	columns: record(string(), columnV2),
	indexes: record(string(), indexV2),
}).strict();

const enumSchemaV1 = object({
	name: string(),
	values: record(string(), string()),
}).strict();

const enumSchema = object({
	name: string(),
	schema: string(),
	values: string().array(),
}).strict();

export const pgSchemaV2 = object({
	version: literal('2'),
	tables: record(string(), tableV2),
	enums: record(string(), enumSchemaV1),
}).strict();

// ------- V1 --------
const references = object({
	foreignKeyName: string(),
	table: string(),
	column: string(),
	onDelete: string().optional(),
	onUpdate: string().optional(),
}).strict();

const columnV1 = object({
	name: string(),
	type: string(),
	primaryKey: boolean(),
// ... (827 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does pgSchema.ts do?
pgSchema.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 pgSchema.ts?
pgSchema.ts defines 21 function(s): PgSquasher.squashCheck, PgSquasher.squashFK, PgSquasher.squashIdentity, PgSquasher.squashIdx, PgSquasher.squashIdxPush, PgSquasher.squashPK, PgSquasher.squashPolicy, PgSquasher.squashPolicyPush, PgSquasher.squashSequence, PgSquasher.squashUnique, and 11 more.
What does pgSchema.ts depend on?
pgSchema.ts imports 3 module(s): global.ts, mapValues, zod.
What files import pgSchema.ts?
pgSchema.ts is imported by 15 file(s): api.ts, index.ts, introspect-pg.ts, introspect.ts, jsonStatements.ts, migrate.ts, migrationPreparator.ts, pgIntrospect.ts, and 7 more.
Where is pgSchema.ts in the architecture?
pgSchema.ts is located at drizzle-kit/src/serializer/pgSchema.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