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

pg-array.test.ts — drizzle-orm Source File

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

Entity Profile

Dependency Diagram

graph LR
  56c4e713_8ca5_eb7e_cff6_abb270d44bf3["pg-array.test.ts"]
  fb6b4a65_030b_ce6b_df0d_2be21adcd2b3["schemaDiffer.ts"]
  56c4e713_8ca5_eb7e_cff6_abb270d44bf3 --> fb6b4a65_030b_ce6b_df0d_2be21adcd2b3
  c00494ea_6230_22b6_9b91_d37781a8ac08["diffTestSchemas"]
  56c4e713_8ca5_eb7e_cff6_abb270d44bf3 --> c00494ea_6230_22b6_9b91_d37781a8ac08
  53497908_16e7_977d_e97d_7414884a88a6["pg-core"]
  56c4e713_8ca5_eb7e_cff6_abb270d44bf3 --> 53497908_16e7_977d_e97d_7414884a88a6
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  56c4e713_8ca5_eb7e_cff6_abb270d44bf3 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  style 56c4e713_8ca5_eb7e_cff6_abb270d44bf3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {
	bigint,
	boolean,
	date,
	integer,
	json,
	pgEnum,
	pgTable,
	serial,
	text,
	timestamp,
	uuid,
} from 'drizzle-orm/pg-core';
import { expect, test } from 'vitest';
import { diffTestSchemas } from './schemaDiffer';

test('array #1: empty array default', async (t) => {
	const from = {
		test: pgTable('test', {
			id: serial('id').primaryKey(),
		}),
	};
	const to = {
		test: pgTable('test', {
			id: serial('id').primaryKey(),
			values: integer('values').array().default([]),
		}),
	};

	const { statements } = await diffTestSchemas(from, to, []);

	expect(statements.length).toBe(1);
	expect(statements[0]).toStrictEqual({
		type: 'alter_table_add_column',
		tableName: 'test',
		schema: '',
		column: { name: 'values', type: 'integer[]', primaryKey: false, notNull: false, default: "'{}'" },
	});
});

test('array #2: integer array default', async (t) => {
	const from = {
		test: pgTable('test', {
			id: serial('id').primaryKey(),
		}),
	};
	const to = {
		test: pgTable('test', {
			id: serial('id').primaryKey(),
			values: integer('values').array().default([1, 2, 3]),
		}),
	};

	const { statements } = await diffTestSchemas(from, to, []);

	expect(statements.length).toBe(1);
	expect(statements[0]).toStrictEqual({
		type: 'alter_table_add_column',
		tableName: 'test',
		schema: '',
// ... (311 more lines)

Domain

Dependencies

Frequently Asked Questions

What does pg-array.test.ts do?
pg-array.test.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain.
What does pg-array.test.ts depend on?
pg-array.test.ts imports 4 module(s): diffTestSchemas, pg-core, schemaDiffer.ts, vitest.
Where is pg-array.test.ts in the architecture?
pg-array.test.ts is located at drizzle-kit/tests/pg-array.test.ts (domain: DrizzleORM, directory: drizzle-kit/tests).

Analyze Your Own Codebase

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

Try Supermodel Free