Home / File/ pg.test.ts — drizzle-orm Source File

pg.test.ts — drizzle-orm Source File

Architecture documentation for pg.test.ts, a typescript file in the drizzle-orm codebase. 8 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  40bbe23e_04df_db64_1cd5_0473ee6e7536["pg.test.ts"]
  0fabdd81_61c9_bb7c_7ddf_dde7a6071abc["index.ts"]
  40bbe23e_04df_db64_1cd5_0473ee6e7536 --> 0fabdd81_61c9_bb7c_7ddf_dde7a6071abc
  e2db8cff_d688_4f7a_2494_cbda1c3623cc["reset"]
  40bbe23e_04df_db64_1cd5_0473ee6e7536 --> e2db8cff_d688_4f7a_2494_cbda1c3623cc
  ee61d65c_3a91_eebf_195c_778a484baf2b["seed"]
  40bbe23e_04df_db64_1cd5_0473ee6e7536 --> ee61d65c_3a91_eebf_195c_778a484baf2b
  10811022_1dc4_478d_4c8e_4dc32de6adc7["pgSchema.ts"]
  40bbe23e_04df_db64_1cd5_0473ee6e7536 --> 10811022_1dc4_478d_4c8e_4dc32de6adc7
  cbab40d4_ac7c_1d5b_bd7b_7bf6059aeaf6["pglite"]
  40bbe23e_04df_db64_1cd5_0473ee6e7536 --> cbab40d4_ac7c_1d5b_bd7b_7bf6059aeaf6
  690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"]
  40bbe23e_04df_db64_1cd5_0473ee6e7536 --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031
  7a81538d_84ea_28df_3d10_5306fd885d26["pglite"]
  40bbe23e_04df_db64_1cd5_0473ee6e7536 --> 7a81538d_84ea_28df_3d10_5306fd885d26
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  40bbe23e_04df_db64_1cd5_0473ee6e7536 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  style 40bbe23e_04df_db64_1cd5_0473ee6e7536 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { PGlite } from '@electric-sql/pglite';
import { relations, sql } from 'drizzle-orm';
import type { PgliteDatabase } from 'drizzle-orm/pglite';
import { drizzle } from 'drizzle-orm/pglite';
import { afterAll, afterEach, beforeAll, expect, test, vi } from 'vitest';
import { reset, seed } from '../../src/index.ts';
import * as schema from './pgSchema.ts';

let client: PGlite;
let db: PgliteDatabase;

beforeAll(async () => {
	client = new PGlite();

	db = drizzle(client);

	await db.execute(sql`CREATE SCHEMA "seeder_lib_pg";`);
	await db.execute(
		sql`
			    CREATE TABLE IF NOT EXISTS "seeder_lib_pg"."customer" (
				"id" varchar(256) PRIMARY KEY NOT NULL,
				"company_name" text NOT NULL,
				"contact_name" text NOT NULL,
				"contact_title" text NOT NULL,
				"address" text NOT NULL,
				"city" text NOT NULL,
				"postal_code" text,
				"region" text,
				"country" text NOT NULL,
				"phone" text NOT NULL,
				"fax" text
			);
		`,
	);

	await db.execute(
		sql`
			    CREATE TABLE IF NOT EXISTS "seeder_lib_pg"."order_detail" (
				"unit_price" numeric NOT NULL,
				"quantity" integer NOT NULL,
				"discount" numeric NOT NULL,
				"order_id" integer NOT NULL,
				"product_id" integer NOT NULL
			);
		`,
	);

	await db.execute(
		sql`
			    CREATE TABLE IF NOT EXISTS "seeder_lib_pg"."employee" (
				"id" integer PRIMARY KEY NOT NULL,
				"last_name" text NOT NULL,
				"first_name" text,
				"title" text NOT NULL,
				"title_of_courtesy" text NOT NULL,
				"birth_date" timestamp NOT NULL,
				"hire_date" timestamp NOT NULL,
				"address" text NOT NULL,
				"city" text NOT NULL,
				"postal_code" text NOT NULL,
// ... (376 more lines)

Domain

Dependencies

Frequently Asked Questions

What does pg.test.ts do?
pg.test.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleSeed domain.
What does pg.test.ts depend on?
pg.test.ts imports 8 module(s): drizzle-orm, index.ts, pgSchema.ts, pglite, pglite, reset, seed, vitest.
Where is pg.test.ts in the architecture?
pg.test.ts is located at drizzle-seed/tests/pg/pg.test.ts (domain: DrizzleSeed, 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