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

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

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

Entity Profile

Dependency Diagram

graph LR
  88af153b_b6b2_4922_2ae7_02bdb6df5f9c["sqlite-columns.test.ts"]
  fb6b4a65_030b_ce6b_df0d_2be21adcd2b3["schemaDiffer.ts"]
  88af153b_b6b2_4922_2ae7_02bdb6df5f9c --> fb6b4a65_030b_ce6b_df0d_2be21adcd2b3
  843d184b_68ea_28e0_a4e7_11ed8d0a221a["diffTestSchemasSqlite"]
  88af153b_b6b2_4922_2ae7_02bdb6df5f9c --> 843d184b_68ea_28e0_a4e7_11ed8d0a221a
  25248a9d_ba06_2b33_4421_8575da2f9c34["sqlite-core"]
  88af153b_b6b2_4922_2ae7_02bdb6df5f9c --> 25248a9d_ba06_2b33_4421_8575da2f9c34
  76cb6b0b_4692_581e_e6e4_769d23792713["jsonStatements"]
  88af153b_b6b2_4922_2ae7_02bdb6df5f9c --> 76cb6b0b_4692_581e_e6e4_769d23792713
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  88af153b_b6b2_4922_2ae7_02bdb6df5f9c --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  style 88af153b_b6b2_4922_2ae7_02bdb6df5f9c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {
	AnySQLiteColumn,
	foreignKey,
	index,
	int,
	integer,
	primaryKey,
	sqliteTable,
	text,
} from 'drizzle-orm/sqlite-core';
import { JsonCreateIndexStatement, JsonRecreateTableStatement } from 'src/jsonStatements';
import { expect, test } from 'vitest';
import { diffTestSchemasSqlite } from './schemaDiffer';

test('create table with id', async (t) => {
	const schema = {
		users: sqliteTable('users', {
			id: int('id').primaryKey({ autoIncrement: true }),
		}),
	};

	const { statements } = await diffTestSchemasSqlite({}, schema, []);

	expect(statements.length).toBe(1);
	expect(statements[0]).toStrictEqual({
		type: 'sqlite_create_table',
		tableName: 'users',
		columns: [
			{
				name: 'id',
				type: 'integer',
				primaryKey: true,
				notNull: true,
				autoincrement: true,
			},
		],
		uniqueConstraints: [],
		referenceData: [],
		compositePKs: [],
		checkConstraints: [],
	});
});

test('add columns #1', async (t) => {
	const schema1 = {
		users: sqliteTable('users', {
			id: int('id').primaryKey({ autoIncrement: true }),
		}),
	};

	const schema2 = {
		users: sqliteTable('users', {
			id: int('id').primaryKey({ autoIncrement: true }),
			name: text('name').notNull(),
		}),
	};

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

	expect(statements.length).toBe(1);
// ... (990 more lines)

Domain

Dependencies

Frequently Asked Questions

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