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

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

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

import { pgSchema, pgSequence } from 'drizzle-orm/pg-core';
import { expect, test } from 'vitest';
import { diffTestSchemas } from './schemaDiffer';

test('create sequence', async () => {
	const from = {};
	const to = {
		seq: pgSequence('name', { startWith: 100 }),
	};

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

	expect(statements).toStrictEqual([
		{
			name: 'name',
			schema: 'public',
			type: 'create_sequence',
			values: {
				cache: '1',
				cycle: false,
				increment: '1',
				maxValue: '9223372036854775807',
				minValue: '1',
				startWith: '100',
			},
		},
	]);
	expect(sqlStatements).toStrictEqual([
		'CREATE SEQUENCE "public"."name" INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START WITH 100 CACHE 1;',
	]);
});

test('create sequence: all fields', async () => {
	const from = {};
	const to = {
		seq: pgSequence('name', {
			startWith: 100,
			maxValue: 10000,
			minValue: 100,
			cycle: true,
			cache: 10,
			increment: 2,
		}),
	};

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

	expect(statements).toStrictEqual([
		{
			type: 'create_sequence',
			name: 'name',
			schema: 'public',
			values: {
				startWith: '100',
				maxValue: '10000',
				minValue: '100',
				cycle: true,
				cache: '10',
				increment: '2',
			},
// ... (239 more lines)

Domain

Dependencies

Frequently Asked Questions

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