Home / File/ d1-batch.test.ts — drizzle-orm Source File

d1-batch.test.ts — drizzle-orm Source File

Architecture documentation for d1-batch.test.ts, a typescript file in the drizzle-orm codebase. 7 imports, 0 dependents.

File typescript DrizzleORM SQLDialects 7 imports 7 functions

Entity Profile

Dependency Diagram

graph LR
  217d8ff7_ac18_f552_4097_dc51d5ac3b12["d1-batch.test.ts"]
  c440e00a_e318_94ac_100c_9843a182c7a4["config"]
  217d8ff7_ac18_f552_4097_dc51d5ac3b12 --> c440e00a_e318_94ac_100c_9843a182c7a4
  a747a5eb_af84_a763_85ed_2a94aae8816c["d1"]
  217d8ff7_ac18_f552_4097_dc51d5ac3b12 --> a747a5eb_af84_a763_85ed_2a94aae8816c
  6f6d3074_4c5f_2854_792a_e2b784ba4912["shared"]
  217d8ff7_ac18_f552_4097_dc51d5ac3b12 --> 6f6d3074_4c5f_2854_792a_e2b784ba4912
  690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"]
  217d8ff7_ac18_f552_4097_dc51d5ac3b12 --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031
  9825ea15_f492_5ec2_8d69_db5f4e0384c9["d1"]
  217d8ff7_ac18_f552_4097_dc51d5ac3b12 --> 9825ea15_f492_5ec2_8d69_db5f4e0384c9
  25248a9d_ba06_2b33_4421_8575da2f9c34["sqlite-core"]
  217d8ff7_ac18_f552_4097_dc51d5ac3b12 --> 25248a9d_ba06_2b33_4421_8575da2f9c34
  8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"]
  217d8ff7_ac18_f552_4097_dc51d5ac3b12 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686
  style 217d8ff7_ac18_f552_4097_dc51d5ac3b12 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/// <reference types="@cloudflare/workers-types" />
import 'dotenv/config';
import { D1Database, D1DatabaseAPI } from '@miniflare/d1';
import { createSQLiteDB } from '@miniflare/shared';
import { eq, relations, sql } from 'drizzle-orm';
import type { DrizzleD1Database } from 'drizzle-orm/d1';
import { drizzle } from 'drizzle-orm/d1';
import { type AnySQLiteColumn, integer, primaryKey, sqliteTable, text } from 'drizzle-orm/sqlite-core';
import { afterAll, beforeAll, beforeEach, expect, expectTypeOf, test } from 'vitest';

const ENABLE_LOGGING = false;

export const usersTable = sqliteTable('users', {
	id: integer('id').primaryKey({ autoIncrement: true }),
	name: text('name').notNull(),
	verified: integer('verified').notNull().default(0),
	invitedBy: integer('invited_by').references((): AnySQLiteColumn => usersTable.id),
});
export const usersConfig = relations(usersTable, ({ one, many }) => ({
	invitee: one(usersTable, {
		fields: [usersTable.invitedBy],
		references: [usersTable.id],
	}),
	usersToGroups: many(usersToGroupsTable),
	posts: many(postsTable),
}));

export const groupsTable = sqliteTable('groups', {
	id: integer('id').primaryKey({ autoIncrement: true }),
	name: text('name').notNull(),
	description: text('description'),
});
export const groupsConfig = relations(groupsTable, ({ many }) => ({
	usersToGroups: many(usersToGroupsTable),
}));

export const usersToGroupsTable = sqliteTable(
	'users_to_groups',
	{
		id: integer('id').primaryKey({ autoIncrement: true }),
		userId: integer('user_id', { mode: 'number' }).notNull().references(
			() => usersTable.id,
		),
		groupId: integer('group_id', { mode: 'number' }).notNull().references(
			() => groupsTable.id,
		),
	},
	(t) => ({
		pk: primaryKey({ columns: [t.userId, t.groupId] }),
	}),
);
export const usersToGroupsConfig = relations(usersToGroupsTable, ({ one }) => ({
	group: one(groupsTable, {
		fields: [usersToGroupsTable.groupId],
		references: [groupsTable.id],
	}),
	user: one(usersTable, {
		fields: [usersToGroupsTable.userId],
		references: [usersTable.id],
	}),
// ... (489 more lines)

Domain

Subdomains

Dependencies

  • config
  • d1
  • d1
  • drizzle-orm
  • shared
  • sqlite-core
  • vitest

Frequently Asked Questions

What does d1-batch.test.ts do?
d1-batch.test.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, SQLDialects subdomain.
What functions are defined in d1-batch.test.ts?
d1-batch.test.ts defines 7 function(s): commentLikesConfig, commentsConfig, groupsConfig, postsConfig, usersConfig, usersToGroupsConfig, usersToGroupsTable.
What does d1-batch.test.ts depend on?
d1-batch.test.ts imports 7 module(s): config, d1, d1, drizzle-orm, shared, sqlite-core, vitest.
Where is d1-batch.test.ts in the architecture?
d1-batch.test.ts is located at integration-tests/tests/sqlite/d1-batch.test.ts (domain: DrizzleORM, subdomain: SQLDialects, directory: integration-tests/tests/sqlite).

Analyze Your Own Codebase

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

Try Supermodel Free