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

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

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

import { integer, pgTable, primaryKey, serial, text, uuid, varchar } from 'drizzle-orm/pg-core';
import { expect, test } from 'vitest';
import { diffTestSchemas } from './schemaDiffer';

test('add columns #1', async (t) => {
	const schema1 = {
		users: pgTable('users', {
			id: serial('id').primaryKey(),
		}),
	};

	const schema2 = {
		users: pgTable('users', {
			id: serial('id').primaryKey(),
			name: text('name'),
		}),
	};

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

	expect(statements.length).toBe(1);
	expect(statements[0]).toStrictEqual({
		type: 'alter_table_add_column',
		tableName: 'users',
		schema: '',
		column: { name: 'name', type: 'text', primaryKey: false, notNull: false },
	});
});

test('add columns #2', async (t) => {
	const schema1 = {
		users: pgTable('users', {
			id: serial('id').primaryKey(),
		}),
	};

	const schema2 = {
		users: pgTable('users', {
			id: serial('id').primaryKey(),
			name: text('name'),
			email: text('email'),
		}),
	};

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

	expect(statements.length).toBe(2);
	expect(statements[0]).toStrictEqual({
		type: 'alter_table_add_column',
		tableName: 'users',
		schema: '',
		column: { name: 'name', type: 'text', primaryKey: false, notNull: false },
	});
	expect(statements[1]).toStrictEqual({
		type: 'alter_table_add_column',
		tableName: 'users',
		schema: '',
		column: { name: 'email', type: 'text', primaryKey: false, notNull: false },
	});
});
// ... (425 more lines)

Domain

Dependencies

Frequently Asked Questions

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