Home / File/ mysqlSchema.ts — drizzle-orm Source File

mysqlSchema.ts — drizzle-orm Source File

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

File typescript DrizzleORM SQLDialects 2 imports 1 dependents 4 functions

Entity Profile

Dependency Diagram

graph LR
  4e09dc96_2560_ffd2_131d_3920513a360d["mysqlSchema.ts"]
  690f7dfc_0aea_9ee8_d6e7_26bbb3689031["drizzle-orm"]
  4e09dc96_2560_ffd2_131d_3920513a360d --> 690f7dfc_0aea_9ee8_d6e7_26bbb3689031
  93ed9350_daa0_6c21_81a6_ed6b2a48bbdf["mysql-core"]
  4e09dc96_2560_ffd2_131d_3920513a360d --> 93ed9350_daa0_6c21_81a6_ed6b2a48bbdf
  0c76d57a_c3c3_e7f0_3e17_94521703ac01["softRelations.test.ts"]
  0c76d57a_c3c3_e7f0_3e17_94521703ac01 --> 4e09dc96_2560_ffd2_131d_3920513a360d
  style 4e09dc96_2560_ffd2_131d_3920513a360d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { relations } from 'drizzle-orm';
import { float, int, mysqlTable, text, timestamp, varchar } from 'drizzle-orm/mysql-core';

export const customers = mysqlTable('customer', {
	id: varchar('id', { length: 256 }).primaryKey(),
	companyName: text('company_name').notNull(),
	contactName: text('contact_name').notNull(),
	contactTitle: text('contact_title').notNull(),
	address: text('address').notNull(),
	city: text('city').notNull(),
	postalCode: text('postal_code'),
	region: text('region'),
	country: text('country').notNull(),
	phone: text('phone').notNull(),
	fax: text('fax'),
});

export const employees = mysqlTable(
	'employee',
	{
		id: int('id').primaryKey(),
		lastName: text('last_name').notNull(),
		firstName: text('first_name'),
		title: text('title').notNull(),
		titleOfCourtesy: text('title_of_courtesy').notNull(),
		birthDate: timestamp('birth_date').notNull(),
		hireDate: timestamp('hire_date').notNull(),
		address: text('address').notNull(),
		city: text('city').notNull(),
		postalCode: text('postal_code').notNull(),
		country: text('country').notNull(),
		homePhone: text('home_phone').notNull(),
		extension: int('extension').notNull(),
		notes: text('notes').notNull(),
		reportsTo: int('reports_to'),
		photoPath: text('photo_path'),
	},
);

export const employeesRelations = relations(employees, ({ one }) => ({
	employee: one(employees, {
		fields: [employees.reportsTo],
		references: [employees.id],
	}),
}));

export const orders = mysqlTable('order', {
	id: int('id').primaryKey(),
	orderDate: timestamp('order_date').notNull(),
	requiredDate: timestamp('required_date').notNull(),
	shippedDate: timestamp('shipped_date'),
	shipVia: int('ship_via').notNull(),
	freight: float('freight').notNull(),
	shipName: text('ship_name').notNull(),
	shipCity: text('ship_city').notNull(),
	shipRegion: text('ship_region'),
	shipPostalCode: text('ship_postal_code'),
	shipCountry: text('ship_country').notNull(),

	customerId: varchar('customer_id', { length: 256 }).notNull(),
// ... (69 more lines)

Domain

Subdomains

Dependencies

  • drizzle-orm
  • mysql-core

Frequently Asked Questions

What does mysqlSchema.ts do?
mysqlSchema.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 mysqlSchema.ts?
mysqlSchema.ts defines 4 function(s): detailsRelations, employeesRelations, ordersRelations, productsRelations.
What does mysqlSchema.ts depend on?
mysqlSchema.ts imports 2 module(s): drizzle-orm, mysql-core.
What files import mysqlSchema.ts?
mysqlSchema.ts is imported by 1 file(s): softRelations.test.ts.
Where is mysqlSchema.ts in the architecture?
mysqlSchema.ts is located at drizzle-seed/tests/mysql/softRelationsTest/mysqlSchema.ts (domain: DrizzleORM, subdomain: SQLDialects, directory: drizzle-seed/tests/mysql/softRelationsTest).

Analyze Your Own Codebase

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

Try Supermodel Free