Home / File/ mysql.schema.ts — drizzle-orm Source File

mysql.schema.ts — drizzle-orm Source File

Architecture documentation for mysql.schema.ts, a typescript file in the drizzle-orm codebase. 2 imports, 2 dependents.

File typescript DrizzleORM RelationalQuery 2 imports 2 dependents 7 functions

Entity Profile

Dependency Diagram

graph LR
  d2943d45_7405_d988_d45c_daf2caa9d414["mysql.schema.ts"]
  93ed9350_daa0_6c21_81a6_ed6b2a48bbdf["mysql-core"]
  d2943d45_7405_d988_d45c_daf2caa9d414 --> 93ed9350_daa0_6c21_81a6_ed6b2a48bbdf
  690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"]
  d2943d45_7405_d988_d45c_daf2caa9d414 --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031
  93058579_3ed0_2909_2b25_e74d35b5c234["mysql.planetscale.test.ts"]
  93058579_3ed0_2909_2b25_e74d35b5c234 --> d2943d45_7405_d988_d45c_daf2caa9d414
  3a2ed84b_1203_213d_b5c0_60d651c5d89e["mysql.test.ts"]
  3a2ed84b_1203_213d_b5c0_60d651c5d89e --> d2943d45_7405_d988_d45c_daf2caa9d414
  style d2943d45_7405_d988_d45c_daf2caa9d414 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {
	type AnyMySqlColumn,
	bigint,
	boolean,
	mysqlSchema,
	mysqlTable,
	primaryKey,
	serial,
	text,
	timestamp,
} from 'drizzle-orm/mysql-core';

import { relations } from 'drizzle-orm';

export const usersTable = mysqlTable('users', {
	id: serial('id').primaryKey(),
	name: text('name').notNull(),
	verified: boolean('verified').notNull().default(false),
	invitedBy: bigint('invited_by', { mode: 'number' }).references(
		(): AnyMySqlColumn => usersTable.id,
	),
});

const schemaV1 = mysqlSchema('schemaV1');

export const usersV1 = schemaV1.table('usersV1', {
	id: serial('id').primaryKey(),
	name: text('name').notNull(),
	verified: boolean('verified').notNull().default(false),
	invitedBy: bigint('invited_by', { mode: 'number' }),
});

export const usersTableV1 = schemaV1.table('users_table_V1', {
	id: serial('id').primaryKey(),
	name: text('name').notNull(),
	verified: boolean('verified').notNull().default(false),
	invitedBy: bigint('invited_by', { mode: 'number' }),
});

export const usersConfig = relations(usersTable, ({ one, many }) => ({
	invitee: one(usersTable, {
		fields: [usersTable.invitedBy],
		references: [usersTable.id],
	}),
	usersToGroups: many(usersToGroupsTable),
	posts: many(postsTable),
	comments: many(commentsTable),
}));

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

export const usersToGroupsTable = mysqlTable(
	'users_to_groups',
// ... (88 more lines)

Domain

Subdomains

Dependencies

  • drizzle-orm
  • mysql-core

Frequently Asked Questions

What does mysql.schema.ts do?
mysql.schema.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, RelationalQuery subdomain.
What functions are defined in mysql.schema.ts?
mysql.schema.ts defines 7 function(s): commentLikesConfig, commentsConfig, groupsConfig, postsConfig, usersConfig, usersToGroupsConfig, usersToGroupsTable.
What does mysql.schema.ts depend on?
mysql.schema.ts imports 2 module(s): drizzle-orm, mysql-core.
What files import mysql.schema.ts?
mysql.schema.ts is imported by 2 file(s): mysql.planetscale.test.ts, mysql.test.ts.
Where is mysql.schema.ts in the architecture?
mysql.schema.ts is located at integration-tests/tests/relational/mysql.schema.ts (domain: DrizzleORM, subdomain: RelationalQuery, 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