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

tables.ts — drizzle-orm Source File

Architecture documentation for tables.ts, a typescript file in the drizzle-orm codebase. 11 imports, 6 dependents.

File typescript DrizzleORM SQLDialects 11 imports 6 dependents 14 functions

Entity Profile

Dependency Diagram

graph LR
  19c69e5c_3d0f_1262_b345_f1446e5c039c["tables.ts"]
  0e3c50de_fbb6_eb17_22a4_8121934f6fdf["db.ts"]
  19c69e5c_3d0f_1262_b345_f1446e5c039c --> 0e3c50de_fbb6_eb17_22a4_8121934f6fdf
  3f58c8f4_b305_acb0_933a_0541231c5109["node:crypto"]
  19c69e5c_3d0f_1262_b345_f1446e5c039c --> 3f58c8f4_b305_acb0_933a_0541231c5109
  25b05299_f48f_bceb_01ca_1343d330a8f7["utils.ts"]
  19c69e5c_3d0f_1262_b345_f1446e5c039c --> 25b05299_f48f_bceb_01ca_1343d330a8f7
  2dc784c6_95e9_4e28_ec81_7caf4acbd426["column-builder.ts"]
  19c69e5c_3d0f_1262_b345_f1446e5c039c --> 2dc784c6_95e9_4e28_ec81_7caf4acbd426
  1da0a48e_f7fe_5ea4_cee2_3ed7d3f39f31["index.ts"]
  19c69e5c_3d0f_1262_b345_f1446e5c039c --> 1da0a48e_f7fe_5ea4_cee2_3ed7d3f39f31
  4de19fea_4352_ab55_6b9a_9a896c955556["schema.ts"]
  19c69e5c_3d0f_1262_b345_f1446e5c039c --> 4de19fea_4352_ab55_6b9a_9a896c955556
  324d9d3c_cc90_914e_9860_1b0826f4780e["view.ts"]
  19c69e5c_3d0f_1262_b345_f1446e5c039c --> 324d9d3c_cc90_914e_9860_1b0826f4780e
  5c46beaf_8b59_d2e3_def3_8af6daf1fccd["index.ts"]
  19c69e5c_3d0f_1262_b345_f1446e5c039c --> 5c46beaf_8b59_d2e3_def3_8af6daf1fccd
  be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd["sql.ts"]
  19c69e5c_3d0f_1262_b345_f1446e5c039c --> be483a7f_d5d7_7a9b_9a13_44a4a6aafbbd
  1fd6ac27_a0fb_a054_a358_c8766c3fcbd7["table.ts"]
  19c69e5c_3d0f_1262_b345_f1446e5c039c --> 1fd6ac27_a0fb_a054_a358_c8766c3fcbd7
  ecce3253_1e75_a87f_27b3_ca87e81a3024["utils.ts"]
  19c69e5c_3d0f_1262_b345_f1446e5c039c --> ecce3253_1e75_a87f_27b3_ca87e81a3024
  17a58b86_c6ea_9812_f57c_197b3715509b["aliased-table.ts"]
  17a58b86_c6ea_9812_f57c_197b3715509b --> 19c69e5c_3d0f_1262_b345_f1446e5c039c
  7370e003_f975_d191_d895_8c264d3e9bb3["delete.ts"]
  7370e003_f975_d191_d895_8c264d3e9bb3 --> 19c69e5c_3d0f_1262_b345_f1446e5c039c
  efec4ff9_ee06_0af2_67ca_4d6bba73f3a5["insert.ts"]
  efec4ff9_ee06_0af2_67ca_4d6bba73f3a5 --> 19c69e5c_3d0f_1262_b345_f1446e5c039c
  style 19c69e5c_3d0f_1262_b345_f1446e5c039c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as crypto from 'node:crypto';
import { type Equal, Expect } from 'type-tests/utils.ts';
import type { BuildColumn } from '~/column-builder.ts';
import {
	bigint,
	binary,
	boolean,
	char,
	check,
	customType,
	date,
	datetime,
	decimal,
	double,
	float,
	foreignKey,
	index,
	int,
	json,
	longtext,
	mediumint,
	mediumtext,
	type MySqlColumn,
	mysqlEnum,
	mysqlTable,
	primaryKey,
	real,
	serial,
	smallint,
	text,
	time,
	timestamp,
	tinyint,
	tinytext,
	unique,
	uniqueIndex,
	varbinary,
	varchar,
	year,
} from '~/mysql-core/index.ts';
import { mysqlSchema } from '~/mysql-core/schema.ts';
import { mysqlView, type MySqlViewWithSelection } from '~/mysql-core/view.ts';
import { eq, gt } from '~/sql/expressions/index.ts';
import { sql } from '~/sql/sql.ts';
import type { InferSelectModel } from '~/table.ts';
import type { Simplify } from '~/utils.ts';
import { db } from './db.ts';

export const users = mysqlTable(
	'users_table',
	{
		id: serial('id').primaryKey(),
		homeCity: int('home_city')
			.notNull()
			.references(() => cities.id),
		currentCity: int('current_city').references(() => cities.id),
		serialNullable: serial('serial1'),
		serialNotNull: serial('serial2').notNull(),
		class: text('class', { enum: ['A', 'C'] }).notNull(),
		subClass: text('sub_class', { enum: ['B', 'D'] }),
// ... (1022 more lines)

Domain

Subdomains

Dependencies

  • column-builder.ts
  • db.ts
  • index.ts
  • index.ts
  • node:crypto
  • schema.ts
  • sql.ts
  • table.ts
  • utils.ts
  • utils.ts
  • view.ts

Frequently Asked Questions

What does tables.ts do?
tables.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, SQLDialects subdomain.
What functions are defined in tables.ts?
tables.ts defines 14 function(s): cities, citiesCustom, classes, customOptionalConfig.dataType, customOptionalConfig.fromDriver, customOptionalConfig.toDriver, customRequiredConfig.dataType, customRequiredConfig.fromDriver, customRequiredConfig.toDriver, customText.dataType, and 4 more.
What does tables.ts depend on?
tables.ts imports 11 module(s): column-builder.ts, db.ts, index.ts, index.ts, node:crypto, schema.ts, sql.ts, table.ts, and 3 more.
What files import tables.ts?
tables.ts is imported by 6 file(s): aliased-table.ts, delete.ts, insert.ts, select.ts, set-operators.ts, update.ts.
Where is tables.ts in the architecture?
tables.ts is located at drizzle-orm/type-tests/mysql/tables.ts (domain: DrizzleORM, subdomain: SQLDialects, directory: drizzle-orm/type-tests/mysql).

Analyze Your Own Codebase

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

Try Supermodel Free