Home / File/ neon-serverless.test.ts — drizzle-orm Source File

neon-serverless.test.ts — drizzle-orm Source File

Architecture documentation for neon-serverless.test.ts, a typescript file in the drizzle-orm codebase. 15 imports, 0 dependents.

File typescript DrizzleORM DatabaseDrivers 15 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  a4af9c99_7399_27a8_3a5e_94b319250783["neon-serverless.test.ts"]
  d133ab06_e39e_bce4_90ee_a55144ce75c2["pg-common.ts"]
  a4af9c99_7399_27a8_3a5e_94b319250783 --> d133ab06_e39e_bce4_90ee_a55144ce75c2
  d4e96821_5055_cb66_dd7b_f89dd0f8d0a0["tests"]
  a4af9c99_7399_27a8_3a5e_94b319250783 --> d4e96821_5055_cb66_dd7b_f89dd0f8d0a0
  7b6fdfe3_d9a8_26c3_430d_2261b1d7aadb["pg-common-cache.ts"]
  a4af9c99_7399_27a8_3a5e_94b319250783 --> 7b6fdfe3_d9a8_26c3_430d_2261b1d7aadb
  76da0078_4d8f_9615_8689_c44d597d58dc["TestCache"]
  a4af9c99_7399_27a8_3a5e_94b319250783 --> 76da0078_4d8f_9615_8689_c44d597d58dc
  d43d88d6_c6b6_386d_d59b_76b8db53bf29["TestGlobalCache"]
  a4af9c99_7399_27a8_3a5e_94b319250783 --> d43d88d6_c6b6_386d_d59b_76b8db53bf29
  a69d8fa0_a523_c055_3559_0193c74ef267["tests"]
  a4af9c99_7399_27a8_3a5e_94b319250783 --> a69d8fa0_a523_c055_3559_0193c74ef267
  e9867962_df5d_03c5_8e49_973b2b1a930a["serverless"]
  a4af9c99_7399_27a8_3a5e_94b319250783 --> e9867962_df5d_03c5_8e49_973b2b1a930a
  690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"]
  a4af9c99_7399_27a8_3a5e_94b319250783 --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031
  47d362b3_604b_3277_92b3_550347bda1d8["neon-serverless"]
  a4af9c99_7399_27a8_3a5e_94b319250783 --> 47d362b3_604b_3277_92b3_550347bda1d8
  eec3c3fb_a4ae_4cc7_fcd4_85568bedb3f3["migrator"]
  a4af9c99_7399_27a8_3a5e_94b319250783 --> eec3c3fb_a4ae_4cc7_fcd4_85568bedb3f3
  53497908_16e7_977d_e97d_7414884a88a6["pg-core"]
  a4af9c99_7399_27a8_3a5e_94b319250783 --> 53497908_16e7_977d_e97d_7414884a88a6
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  a4af9c99_7399_27a8_3a5e_94b319250783 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  29be5710_53a8_86c7_e03c_bf4a45a258fb["ws"]
  a4af9c99_7399_27a8_3a5e_94b319250783 --> 29be5710_53a8_86c7_e03c_bf4a45a258fb
  5536e6a8_02de_67a7_6eaf_0fd73c9c2d92["common"]
  a4af9c99_7399_27a8_3a5e_94b319250783 --> 5536e6a8_02de_67a7_6eaf_0fd73c9c2d92
  style a4af9c99_7399_27a8_3a5e_94b319250783 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { neonConfig, Pool } from '@neondatabase/serverless';
import { eq, sql } from 'drizzle-orm';
import { drizzle, type NeonDatabase } from 'drizzle-orm/neon-serverless';
import { migrate } from 'drizzle-orm/neon-serverless/migrator';
import { pgTable, serial, timestamp } from 'drizzle-orm/pg-core';
import { afterAll, beforeAll, beforeEach, expect, test } from 'vitest';
import ws from 'ws';
import { skipTests } from '~/common';
import { randomString } from '~/utils';
import { mySchema, tests, usersMigratorTable, usersMySchemaTable, usersTable } from './pg-common';
import { TestCache, TestGlobalCache, tests as cacheTests } from './pg-common-cache';

const ENABLE_LOGGING = false;

let db: NeonDatabase;
let dbGlobalCached: NeonDatabase;
let cachedDb: NeonDatabase;
let client: Pool;

neonConfig.wsProxy = (host) => `${host}:5446/v1`;
neonConfig.useSecureWebSocket = false;
neonConfig.pipelineTLS = false;
neonConfig.pipelineConnect = false;
neonConfig.webSocketConstructor = ws;

beforeAll(async () => {
	const connectionString = process.env['NEON_SERVERLESS_CONNECTION_STRING'];
	if (!connectionString) {
		throw new Error('NEON_SERVERLESS_CONNECTION_STRING is not defined');
	}

	client = new Pool({ connectionString });
	db = drizzle(client, { logger: ENABLE_LOGGING });
	cachedDb = drizzle(client, {
		logger: ENABLE_LOGGING,
		cache: new TestCache(),
	});
	dbGlobalCached = drizzle(client, {
		logger: ENABLE_LOGGING,
		cache: new TestGlobalCache(),
	});
});

afterAll(async () => {
	await client?.end();
});

beforeEach((ctx) => {
	ctx.pg = {
		db,
	};
	ctx.cachedPg = {
		db: cachedDb,
		dbGlobalCached,
	};
});

test('migrator : default migration strategy', async () => {
	await db.execute(sql`drop table if exists all_columns`);
	await db.execute(sql`drop table if exists users12`);
// ... (526 more lines)

Domain

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does neon-serverless.test.ts do?
neon-serverless.test.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, DatabaseDrivers subdomain.
What functions are defined in neon-serverless.test.ts?
neon-serverless.test.ts defines 1 function(s): neonConfig.
What does neon-serverless.test.ts depend on?
neon-serverless.test.ts imports 15 module(s): TestCache, TestGlobalCache, common, drizzle-orm, migrator, neon-serverless, pg-common-cache.ts, pg-common.ts, and 7 more.
Where is neon-serverless.test.ts in the architecture?
neon-serverless.test.ts is located at integration-tests/tests/pg/neon-serverless.test.ts (domain: DrizzleORM, subdomain: DatabaseDrivers, directory: integration-tests/tests/pg).

Analyze Your Own Codebase

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

Try Supermodel Free