Home / File/ schema.types.ts — drizzle-orm Source File

schema.types.ts — drizzle-orm Source File

Architecture documentation for schema.types.ts, a typescript file in the drizzle-orm codebase. 4 imports, 2 dependents.

File typescript ValidationAdapters 4 imports 2 dependents

Entity Profile

Dependency Diagram

graph LR
  37a75c34_5ecc_3525_ecb4_d53dfebc43bb["schema.types.ts"]
  acfeaa81_8bd9_605a_74e7_52a36a49babb["schema.types.internal.ts"]
  37a75c34_5ecc_3525_ecb4_d53dfebc43bb --> acfeaa81_8bd9_605a_74e7_52a36a49babb
  690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"]
  37a75c34_5ecc_3525_ecb4_d53dfebc43bb --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031
  53497908_16e7_977d_e97d_7414884a88a6["pg-core"]
  37a75c34_5ecc_3525_ecb4_d53dfebc43bb --> 53497908_16e7_977d_e97d_7414884a88a6
  2eba3e52_10ef_4b48_38fc_0e1540a5fc3e["v4"]
  37a75c34_5ecc_3525_ecb4_d53dfebc43bb --> 2eba3e52_10ef_4b48_38fc_0e1540a5fc3e
  d3d3a2d1_4197_a39b_12f9_f9c7be54febc["column.ts"]
  d3d3a2d1_4197_a39b_12f9_f9c7be54febc --> 37a75c34_5ecc_3525_ecb4_d53dfebc43bb
  91122f81_e9f3_fa04_26c5_a8235e0646d0["schema.ts"]
  91122f81_e9f3_fa04_26c5_a8235e0646d0 --> 37a75c34_5ecc_3525_ecb4_d53dfebc43bb
  style 37a75c34_5ecc_3525_ecb4_d53dfebc43bb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { Table, View } from 'drizzle-orm';
import type { PgEnum } from 'drizzle-orm/pg-core';
import type { z } from 'zod/v4';
import type { BuildRefine, BuildSchema, NoUnknownKeys } from './schema.types.internal.ts';

export interface CreateSelectSchema<
	TCoerce extends Partial<Record<'bigint' | 'boolean' | 'date' | 'number' | 'string', true>> | true | undefined,
> {
	<TTable extends Table>(table: TTable): BuildSchema<'select', TTable['_']['columns'], undefined, TCoerce>;
	<
		TTable extends Table,
		TRefine extends BuildRefine<TTable['_']['columns'], TCoerce>,
	>(
		table: TTable,
		refine?: NoUnknownKeys<TRefine, TTable['$inferSelect']>,
	): BuildSchema<'select', TTable['_']['columns'], TRefine, TCoerce>;

	<TView extends View>(view: TView): BuildSchema<'select', TView['_']['selectedFields'], undefined, TCoerce>;
	<
		TView extends View,
		TRefine extends BuildRefine<TView['_']['selectedFields'], TCoerce>,
	>(
		view: TView,
		refine: NoUnknownKeys<TRefine, TView['$inferSelect']>,
	): BuildSchema<'select', TView['_']['selectedFields'], TRefine, TCoerce>;

	<TEnum extends PgEnum<any>>(enum_: TEnum): z.ZodEnum<{ [K in TEnum['enumValues'][number]]: K }>;
}

export interface CreateInsertSchema<
	TCoerce extends Partial<Record<'bigint' | 'boolean' | 'date' | 'number' | 'string', true>> | true | undefined,
> {
	<TTable extends Table>(table: TTable): BuildSchema<'insert', TTable['_']['columns'], undefined, TCoerce>;
	<
		TTable extends Table,
		TRefine extends BuildRefine<Pick<TTable['_']['columns'], keyof TTable['$inferInsert']>, TCoerce>,
	>(
		table: TTable,
		refine?: NoUnknownKeys<TRefine, TTable['$inferInsert']>,
	): BuildSchema<'insert', TTable['_']['columns'], TRefine, TCoerce>;
}

export interface CreateUpdateSchema<
	TCoerce extends Partial<Record<'bigint' | 'boolean' | 'date' | 'number' | 'string', true>> | true | undefined,
> {
	<TTable extends Table>(table: TTable): BuildSchema<'update', TTable['_']['columns'], undefined, TCoerce>;
	<
		TTable extends Table,
		TRefine extends BuildRefine<Pick<TTable['_']['columns'], keyof TTable['$inferInsert']>, TCoerce>,
	>(
		table: TTable,
		refine?: TRefine,
	): BuildSchema<'update', TTable['_']['columns'], TRefine, TCoerce>;
}

export interface CreateSchemaFactoryOptions<
	TCoerce extends Partial<Record<'bigint' | 'boolean' | 'date' | 'number' | 'string', true>> | true | undefined,
> {
	zodInstance?: any;
	coerce?: TCoerce;
}

Dependencies

Frequently Asked Questions

What does schema.types.ts do?
schema.types.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the ValidationAdapters domain.
What does schema.types.ts depend on?
schema.types.ts imports 4 module(s): drizzle-orm, pg-core, schema.types.internal.ts, v4.
What files import schema.types.ts?
schema.types.ts is imported by 2 file(s): column.ts, schema.ts.
Where is schema.types.ts in the architecture?
schema.types.ts is located at drizzle-zod/src/schema.types.ts (domain: ValidationAdapters, directory: drizzle-zod/src).

Analyze Your Own Codebase

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

Try Supermodel Free