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

sqlite.test.ts — drizzle-orm Source File

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

Entity Profile

Dependency Diagram

graph LR
  e6fd0679_e472_3149_53fa_c5869d458164["sqlite.test.ts"]
  0fabdd81_61c9_bb7c_7ddf_dde7a6071abc["index.ts"]
  e6fd0679_e472_3149_53fa_c5869d458164 --> 0fabdd81_61c9_bb7c_7ddf_dde7a6071abc
  e2db8cff_d688_4f7a_2494_cbda1c3623cc["reset"]
  e6fd0679_e472_3149_53fa_c5869d458164 --> e2db8cff_d688_4f7a_2494_cbda1c3623cc
  ee61d65c_3a91_eebf_195c_778a484baf2b["seed"]
  e6fd0679_e472_3149_53fa_c5869d458164 --> ee61d65c_3a91_eebf_195c_778a484baf2b
  ef2efe5f_9d2d_547c_50b7_e7a4f36e335d["sqliteSchema.ts"]
  e6fd0679_e472_3149_53fa_c5869d458164 --> ef2efe5f_9d2d_547c_50b7_e7a4f36e335d
  ccd8f141_31dd_df9e_0535_43efaea4d6db["better-sqlite3"]
  e6fd0679_e472_3149_53fa_c5869d458164 --> ccd8f141_31dd_df9e_0535_43efaea4d6db
  690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"]
  e6fd0679_e472_3149_53fa_c5869d458164 --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031
  5fb205ef_438e_58ed_ca43_2d0e3ec9cd7b["better-sqlite3"]
  e6fd0679_e472_3149_53fa_c5869d458164 --> 5fb205ef_438e_58ed_ca43_2d0e3ec9cd7b
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  e6fd0679_e472_3149_53fa_c5869d458164 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  style e6fd0679_e472_3149_53fa_c5869d458164 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import BetterSqlite3 from 'better-sqlite3';
import { relations, sql } from 'drizzle-orm';
import type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
import { drizzle } from 'drizzle-orm/better-sqlite3';
import { afterAll, afterEach, beforeAll, expect, test, vi } from 'vitest';
import { reset, seed } from '../../src/index.ts';
import * as schema from './sqliteSchema.ts';

let client: BetterSqlite3.Database;
let db: BetterSQLite3Database;

beforeAll(async () => {
	client = new BetterSqlite3(':memory:');

	db = drizzle(client);

	db.run(
		sql.raw(`
    CREATE TABLE \`customer\` (
	\`id\` text PRIMARY KEY NOT NULL,
	\`company_name\` text NOT NULL,
	\`contact_name\` text NOT NULL,
	\`contact_title\` text NOT NULL,
	\`address\` text NOT NULL,
	\`city\` text NOT NULL,
	\`postal_code\` text,
	\`region\` text,
	\`country\` text NOT NULL,
	\`phone\` text NOT NULL,
	\`fax\` text
);
    `),
	);

	db.run(
		sql.raw(`
    CREATE TABLE \`order_detail\` (
	\`unit_price\` numeric NOT NULL,
	\`quantity\` integer NOT NULL,
	\`discount\` numeric NOT NULL,
	\`order_id\` integer NOT NULL,
	\`product_id\` integer NOT NULL,
	FOREIGN KEY (\`order_id\`) REFERENCES \`order\`(\`id\`) ON UPDATE no action ON DELETE cascade,
	FOREIGN KEY (\`product_id\`) REFERENCES \`product\`(\`id\`) ON UPDATE no action ON DELETE cascade
);
    `),
	);

	db.run(
		sql.raw(`
    CREATE TABLE \`employee\` (
	\`id\` integer PRIMARY KEY NOT NULL,
	\`last_name\` text NOT NULL,
	\`first_name\` text,
	\`title\` text NOT NULL,
	\`title_of_courtesy\` text NOT NULL,
	\`birth_date\` integer NOT NULL,
	\`hire_date\` integer NOT NULL,
	\`address\` text NOT NULL,
	\`city\` text NOT NULL,
// ... (279 more lines)

Domain

Dependencies

Frequently Asked Questions

What does sqlite.test.ts do?
sqlite.test.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleSeed domain.
What does sqlite.test.ts depend on?
sqlite.test.ts imports 8 module(s): better-sqlite3, better-sqlite3, drizzle-orm, index.ts, reset, seed, sqliteSchema.ts, vitest.
Where is sqlite.test.ts in the architecture?
sqlite.test.ts is located at drizzle-seed/tests/sqlite/sqlite.test.ts (domain: DrizzleSeed, directory: drizzle-seed/tests/sqlite).

Analyze Your Own Codebase

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

Try Supermodel Free