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

File typescript DrizzleORM DatabaseDrivers 9 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  66244d8b_f6c8_7e4e_5409_4e7e6a4add95["pg.test.ts"]
  763e0363_0164_92c1_7cf4_a9348fdadbfe["common.ts"]
  66244d8b_f6c8_7e4e_5409_4e7e6a4add95 --> 763e0363_0164_92c1_7cf4_a9348fdadbfe
  53b35b91_936c_7f4d_a22d_e9130832befa["DialectSuite"]
  66244d8b_f6c8_7e4e_5409_4e7e6a4add95 --> 53b35b91_936c_7f4d_a22d_e9130832befa
  65556fb8_f91f_f6b4_57a7_0bd27a4d61f9["run"]
  66244d8b_f6c8_7e4e_5409_4e7e6a4add95 --> 65556fb8_f91f_f6b4_57a7_0bd27a4d61f9
  690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"]
  66244d8b_f6c8_7e4e_5409_4e7e6a4add95 --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031
  53497908_16e7_977d_e97d_7414884a88a6["pg-core"]
  66244d8b_f6c8_7e4e_5409_4e7e6a4add95 --> 53497908_16e7_977d_e97d_7414884a88a6
  76cb6b0b_4692_581e_e6e4_769d23792713["jsonStatements"]
  66244d8b_f6c8_7e4e_5409_4e7e6a4add95 --> 76cb6b0b_4692_581e_e6e4_769d23792713
  672223fe_ace7_8507_b53e_7b913cbfb827["pgSchema"]
  66244d8b_f6c8_7e4e_5409_4e7e6a4add95 --> 672223fe_ace7_8507_b53e_7b913cbfb827
  2080849e_169d_739e_1ba9_1396fc229951["schemaDiffer"]
  66244d8b_f6c8_7e4e_5409_4e7e6a4add95 --> 2080849e_169d_739e_1ba9_1396fc229951
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  66244d8b_f6c8_7e4e_5409_4e7e6a4add95 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  style 66244d8b_f6c8_7e4e_5409_4e7e6a4add95 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { sql } from 'drizzle-orm';
import { index, pgTable, serial, text, vector } from 'drizzle-orm/pg-core';
import { JsonCreateIndexStatement } from 'src/jsonStatements';
import { PgSquasher } from 'src/serializer/pgSchema';
import { diffTestSchemas } from 'tests/schemaDiffer';
import { expect } from 'vitest';
import { DialectSuite, run } from './common';

const pgSuite: DialectSuite = {
	async vectorIndex() {
		const schema1 = {
			users: pgTable('users', {
				id: serial('id').primaryKey(),
				name: vector('name', { dimensions: 3 }),
			}),
		};

		const schema2 = {
			users: pgTable(
				'users',
				{
					id: serial('id').primaryKey(),
					embedding: vector('name', { dimensions: 3 }),
				},
				(t) => ({
					indx2: index('vector_embedding_idx')
						.using('hnsw', t.embedding.op('vector_ip_ops'))
						.with({ m: 16, ef_construction: 64 }),
				}),
			),
		};

		const { statements, sqlStatements } = await diffTestSchemas(
			schema1,
			schema2,
			[],
		);

		expect(statements.length).toBe(1);
		expect(statements[0]).toStrictEqual({
			schema: '',
			tableName: 'users',
			type: 'create_index_pg',
			data: {
				columns: [
					{
						asc: true,
						expression: 'name',
						isExpression: false,
						nulls: 'last',
						opclass: 'vector_ip_ops',
					},
				],
				concurrently: false,
				isUnique: false,
				method: 'hnsw',
				name: 'vector_embedding_idx',
				where: undefined,
				with: {
					ef_construction: 64,
// ... (186 more lines)

Domain

Subdomains

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 DrizzleORM domain, DatabaseDrivers subdomain.
What functions are defined in pg.test.ts?
pg.test.ts defines 3 function(s): pgSuite.indexesToBeTriggered, pgSuite.simpleIndex, pgSuite.vectorIndex.
What does pg.test.ts depend on?
pg.test.ts imports 9 module(s): DialectSuite, common.ts, drizzle-orm, jsonStatements, pg-core, pgSchema, run, schemaDiffer, and 1 more.
Where is pg.test.ts in the architecture?
pg.test.ts is located at drizzle-kit/tests/indexes/pg.test.ts (domain: DrizzleORM, subdomain: DatabaseDrivers, directory: drizzle-kit/tests/indexes).

Analyze Your Own Codebase

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

Try Supermodel Free