Home / File/ libsql-statements.test.ts — drizzle-orm Source File

libsql-statements.test.ts — drizzle-orm Source File

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

Entity Profile

Dependency Diagram

graph LR
  440963c4_becc_d675_8b0d_a90b450f1ea1["libsql-statements.test.ts"]
  fb6b4a65_030b_ce6b_df0d_2be21adcd2b3["schemaDiffer.ts"]
  440963c4_becc_d675_8b0d_a90b450f1ea1 --> fb6b4a65_030b_ce6b_df0d_2be21adcd2b3
  dddf05dc_476a_ddb0_9213_efecd046356f["diffTestSchemasLibSQL"]
  440963c4_becc_d675_8b0d_a90b450f1ea1 --> dddf05dc_476a_ddb0_9213_efecd046356f
  25248a9d_ba06_2b33_4421_8575da2f9c34["sqlite-core"]
  440963c4_becc_d675_8b0d_a90b450f1ea1 --> 25248a9d_ba06_2b33_4421_8575da2f9c34
  76cb6b0b_4692_581e_e6e4_769d23792713["jsonStatements"]
  440963c4_becc_d675_8b0d_a90b450f1ea1 --> 76cb6b0b_4692_581e_e6e4_769d23792713
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  440963c4_becc_d675_8b0d_a90b450f1ea1 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  style 440963c4_becc_d675_8b0d_a90b450f1ea1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

test('drop autoincrement', async (t) => {
	const schema1 = {
		users: sqliteTable('users', {
			id: int('id').primaryKey({ autoIncrement: true }),
		}),
	};

	const schema2 = {
		users: sqliteTable('users', {
			id: int('id').primaryKey({ autoIncrement: false }),
		}),
	};

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

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

test('set autoincrement', async (t) => {
	const schema1 = {
		users: sqliteTable('users', {
			id: int('id').primaryKey({ autoIncrement: false }),
		}),
	};

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

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

	expect(statements.length).toBe(1);
	expect(statements[0]).toStrictEqual({
		columns: [{
			autoincrement: true,
			generated: undefined,
			name: 'id',
// ... (930 more lines)

Domain

Dependencies

Frequently Asked Questions

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