mysql.planetscale.test.ts — drizzle-orm Source File
Architecture documentation for mysql.planetscale.test.ts, a typescript file in the drizzle-orm codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 93058579_3ed0_2909_2b25_e74d35b5c234["mysql.planetscale.test.ts"] d2943d45_7405_d988_d45c_daf2caa9d414["mysql.schema.ts"] 93058579_3ed0_2909_2b25_e74d35b5c234 --> d2943d45_7405_d988_d45c_daf2caa9d414 c440e00a_e318_94ac_100c_9843a182c7a4["config"] 93058579_3ed0_2909_2b25_e74d35b5c234 --> c440e00a_e318_94ac_100c_9843a182c7a4 42a10794_e73a_91c6_c755_ae09e500977e["database"] 93058579_3ed0_2909_2b25_e74d35b5c234 --> 42a10794_e73a_91c6_c755_ae09e500977e 690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"] 93058579_3ed0_2909_2b25_e74d35b5c234 --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031 370f5753_3b9a_0311_6478_c4cd9f360bc9["planetscale-serverless"] 93058579_3ed0_2909_2b25_e74d35b5c234 --> 370f5753_3b9a_0311_6478_c4cd9f360bc9 8d35eaf2_a542_cfd4_fa1a_fafca0f02686["vitest"] 93058579_3ed0_2909_2b25_e74d35b5c234 --> 8d35eaf2_a542_cfd4_fa1a_fafca0f02686 style 93058579_3ed0_2909_2b25_e74d35b5c234 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import 'dotenv/config';
import { Client } from '@planetscale/database';
import { desc, DrizzleError, eq, gt, gte, or, placeholder, sql, TransactionRollbackError } from 'drizzle-orm';
import { drizzle, type PlanetScaleDatabase } from 'drizzle-orm/planetscale-serverless';
import { beforeAll, beforeEach, expect, expectTypeOf, test } from 'vitest';
import * as schema from './mysql.schema.ts';
const { usersTable, postsTable, commentsTable, usersToGroupsTable, groupsTable } = schema;
const ENABLE_LOGGING = false;
/*
Test cases:
- querying nested relation without PK with additional fields
*/
let db: PlanetScaleDatabase<typeof schema>;
beforeAll(async () => {
db = drizzle(
new Client({
url: process.env['PLANETSCALE_CONNECTION_STRING']!,
// host: process.env['DATABASE_HOST']!,
// username: process.env['DATABASE_USERNAME']!,
// password: process.env['DATABASE_PASSWORD']!,
}),
{ schema, logger: ENABLE_LOGGING },
);
await Promise.all([
db.execute(sql`drop table if exists \`users\``),
db.execute(sql`drop table if exists \`groups\``),
db.execute(sql`drop table if exists \`users_to_groups\``),
db.execute(sql`drop table if exists \`posts\``),
db.execute(sql`drop table if exists \`comments\``),
db.execute(sql`drop table if exists \`comment_likes\``),
]);
await Promise.all([
db.execute(
sql`
CREATE TABLE IF NOT EXISTS \`users\` (
\`id\` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL,
\`name\` text NOT NULL,
\`verified\` boolean DEFAULT false NOT NULL,
\`invited_by\` bigint
);
`,
),
db.execute(
sql`
CREATE TABLE IF NOT EXISTS \`groups\` (
\`id\` bigint PRIMARY KEY AUTO_INCREMENT NOT NULL,
\`name\` text NOT NULL,
\`description\` text
);
`,
),
db.execute(
sql`
// ... (6051 more lines)
Domain
Dependencies
- config
- database
- drizzle-orm
- mysql.schema.ts
- planetscale-serverless
- vitest
Source
Frequently Asked Questions
What does mysql.planetscale.test.ts do?
mysql.planetscale.test.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain.
What does mysql.planetscale.test.ts depend on?
mysql.planetscale.test.ts imports 6 module(s): config, database, drizzle-orm, mysql.schema.ts, planetscale-serverless, vitest.
Where is mysql.planetscale.test.ts in the architecture?
mysql.planetscale.test.ts is located at integration-tests/tests/relational/mysql.planetscale.test.ts (domain: DrizzleORM, directory: integration-tests/tests/relational).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free