mysqlSchema.ts — drizzle-orm Source File
Architecture documentation for mysqlSchema.ts, a typescript file in the drizzle-orm codebase. 1 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR eb1e881c_5047_858a_b1d7_0ebf5e119d52["mysqlSchema.ts"] 93ed9350_daa0_6c21_81a6_ed6b2a48bbdf["mysql-core"] eb1e881c_5047_858a_b1d7_0ebf5e119d52 --> 93ed9350_daa0_6c21_81a6_ed6b2a48bbdf acec895d_3abf_95cd_e7b3_cbd4027d025c["mysqlTest.ts"] acec895d_3abf_95cd_e7b3_cbd4027d025c --> eb1e881c_5047_858a_b1d7_0ebf5e119d52 style eb1e881c_5047_858a_b1d7_0ebf5e119d52 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { AnyMySqlColumn } from 'drizzle-orm/mysql-core';
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').references((): AnyMySqlColumn => employees.id),
photoPath: text('photo_path'),
},
);
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()
.references(() => customers.id, { onDelete: 'cascade' }),
employeeId: int('employee_id')
.notNull()
.references(() => employees.id, { onDelete: 'cascade' }),
});
export const suppliers = mysqlTable('supplier', {
id: int('id').primaryKey(),
companyName: text('company_name').notNull(),
contactName: text('contact_name').notNull(),
contactTitle: text('contact_title').notNull(),
address: text('address').notNull(),
city: text('city').notNull(),
region: text('region'),
postalCode: text('postal_code').notNull(),
country: text('country').notNull(),
phone: text('phone').notNull(),
});
export const products = mysqlTable('product', {
id: int('id').primaryKey(),
name: text('name').notNull(),
quantityPerUnit: text('quantity_per_unit').notNull(),
unitPrice: float('unit_price').notNull(),
unitsInStock: int('units_in_stock').notNull(),
unitsOnOrder: int('units_on_order').notNull(),
reorderLevel: int('reorder_level').notNull(),
discontinued: int('discontinued').notNull(),
supplierId: int('supplier_id')
.notNull()
.references(() => suppliers.id, { onDelete: 'cascade' }),
});
export const details = mysqlTable('order_detail', {
unitPrice: float('unit_price').notNull(),
quantity: int('quantity').notNull(),
discount: float('discount').notNull(),
orderId: int('order_id')
.notNull()
.references(() => orders.id, { onDelete: 'cascade' }),
productId: int('product_id')
.notNull()
.references(() => products.id, { onDelete: 'cascade' }),
});
Domain
Dependencies
- mysql-core
Imported By
Source
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.
What does mysqlSchema.ts depend on?
mysqlSchema.ts imports 1 module(s): mysql-core.
What files import mysqlSchema.ts?
mysqlSchema.ts is imported by 1 file(s): mysqlTest.ts.
Where is mysqlSchema.ts in the architecture?
mysqlSchema.ts is located at drizzle-seed/tests/northwind/mysqlSchema.ts (domain: DrizzleORM, directory: drizzle-seed/tests/northwind).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free