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. 1 imports, 1 dependents.

File typescript DrizzleORM 1 imports 1 dependents

Entity Profile

Dependency Diagram

graph LR
  10811022_1dc4_478d_4c8e_4dc32de6adc7["pgSchema.ts"]
  53497908_16e7_977d_e97d_7414884a88a6["pg-core"]
  10811022_1dc4_478d_4c8e_4dc32de6adc7 --> 53497908_16e7_977d_e97d_7414884a88a6
  40bbe23e_04df_db64_1cd5_0473ee6e7536["pg.test.ts"]
  40bbe23e_04df_db64_1cd5_0473ee6e7536 --> 10811022_1dc4_478d_4c8e_4dc32de6adc7
  style 10811022_1dc4_478d_4c8e_4dc32de6adc7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { AnyPgColumn } from 'drizzle-orm/pg-core';
import { integer, numeric, pgSchema, serial, text, timestamp, varchar } from 'drizzle-orm/pg-core';

export const schema = pgSchema('seeder_lib_pg');

export const customers = schema.table('customer', {
	id: varchar('id', { length: 256 }).primaryKey(),
	companyName: text('company_name').notNull(),
	contactName: text('contact_name').notNull(),
	contactTitle: text('contact_title').notNull(),
	address: text('address').notNull(),
	city: text('city').notNull(),
	postalCode: text('postal_code'),
	region: text('region'),
	country: text('country').notNull(),
	phone: text('phone').notNull(),
	fax: text('fax'),
});

export const employees = schema.table(
	'employee',
	{
		id: integer('id').primaryKey(),
		lastName: text('last_name').notNull(),
		firstName: text('first_name'),
		title: text('title').notNull(),
		titleOfCourtesy: text('title_of_courtesy').notNull(),
		birthDate: timestamp('birth_date').notNull(),
		hireDate: timestamp('hire_date').notNull(),
		address: text('address').notNull(),
		city: text('city').notNull(),
		postalCode: text('postal_code').notNull(),
		country: text('country').notNull(),
		homePhone: text('home_phone').notNull(),
		extension: integer('extension').notNull(),
		notes: text('notes').notNull(),
		reportsTo: integer('reports_to').references((): AnyPgColumn => employees.id),
		photoPath: text('photo_path'),
	},
);

export const orders = schema.table('order', {
	id: integer('id').primaryKey(),
	orderDate: timestamp('order_date').notNull(),
	requiredDate: timestamp('required_date').notNull(),
	shippedDate: timestamp('shipped_date'),
	shipVia: integer('ship_via').notNull(),
	freight: numeric('freight').notNull(),
	shipName: text('ship_name').notNull(),
	shipCity: text('ship_city').notNull(),
	shipRegion: text('ship_region'),
	shipPostalCode: text('ship_postal_code'),
	shipCountry: text('ship_country').notNull(),

	customerId: text('customer_id')
		.notNull()
		.references(() => customers.id, { onDelete: 'cascade' }),

	employeeId: integer('employee_id')
		.notNull()
// ... (70 more lines)

Domain

Dependencies

  • pg-core

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 DrizzleORM domain.
What does pgSchema.ts depend on?
pgSchema.ts imports 1 module(s): pg-core.
What files import pgSchema.ts?
pgSchema.ts is imported by 1 file(s): pg.test.ts.
Where is pgSchema.ts in the architecture?
pgSchema.ts is located at drizzle-seed/tests/pg/pgSchema.ts (domain: DrizzleORM, directory: drizzle-seed/tests/pg).

Analyze Your Own Codebase

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

Try Supermodel Free