sqliteSchema.ts — drizzle-orm Source File
Architecture documentation for sqliteSchema.ts, a typescript file in the drizzle-orm codebase. 1 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR c1764f95_5e96_7d42_be68_4ec4663377f9["sqliteSchema.ts"] 25248a9d_ba06_2b33_4421_8575da2f9c34["sqlite-core"] c1764f95_5e96_7d42_be68_4ec4663377f9 --> 25248a9d_ba06_2b33_4421_8575da2f9c34 cffdceef_c81e_ea19_3b0c_d43e88dabc94["sqliteTest.ts"] cffdceef_c81e_ea19_3b0c_d43e88dabc94 --> c1764f95_5e96_7d42_be68_4ec4663377f9 style c1764f95_5e96_7d42_be68_4ec4663377f9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { foreignKey, integer, numeric, sqliteTable, text } from 'drizzle-orm/sqlite-core';
export const customers = sqliteTable('customer', {
id: text('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(),
postalCode: text('postal_code'),
region: text('region'),
country: text('country').notNull(),
phone: text('phone').notNull(),
fax: text('fax'),
});
export const employees = sqliteTable(
'employee',
{
id: integer('id').primaryKey(),
lastName: text('last_name').notNull(),
firstName: text('first_name'),
title: text('title').notNull(),
titleOfCourtesy: text('title_of_courtesy').notNull(),
birthDate: integer('birth_date', { mode: 'timestamp' }).notNull(),
hireDate: integer('hire_date', { mode: 'timestamp' }).notNull(),
address: text('address').notNull(),
city: text('city').notNull(),
postalCode: text('postal_code').notNull(),
country: text('country').notNull(),
homePhone: text('home_phone').notNull(),
extension: integer('extension').notNull(),
notes: text('notes').notNull(),
reportsTo: integer('reports_to'),
photoPath: text('photo_path'),
},
(table) => ({
reportsToFk: foreignKey(() => ({
columns: [table.reportsTo],
foreignColumns: [table.id],
})),
}),
);
export const orders = sqliteTable('order', {
id: integer('id').primaryKey(),
orderDate: integer('order_date', { mode: 'timestamp' }).notNull(),
requiredDate: integer('required_date', { mode: 'timestamp' }).notNull(),
shippedDate: integer('shipped_date', { mode: 'timestamp' }),
shipVia: integer('ship_via').notNull(),
freight: numeric('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: text('customer_id')
.notNull()
.references(() => customers.id, { onDelete: 'cascade' }),
employeeId: integer('employee_id')
.notNull()
.references(() => employees.id, { onDelete: 'cascade' }),
});
export const suppliers = sqliteTable('supplier', {
id: integer('id').primaryKey({ autoIncrement: true }),
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 = sqliteTable('product', {
id: integer('id').primaryKey({ autoIncrement: true }),
name: text('name').notNull(),
quantityPerUnit: text('quantity_per_unit').notNull(),
unitPrice: numeric('unit_price').notNull(),
unitsInStock: integer('units_in_stock').notNull(),
unitsOnOrder: integer('units_on_order').notNull(),
reorderLevel: integer('reorder_level').notNull(),
discontinued: integer('discontinued').notNull(),
supplierId: integer('supplier_id')
.notNull()
.references(() => suppliers.id, { onDelete: 'cascade' }),
});
export const details = sqliteTable('order_detail', {
unitPrice: numeric('unit_price').notNull(),
quantity: integer('quantity').notNull(),
discount: numeric('discount').notNull(),
orderId: integer('order_id')
.notNull()
.references(() => orders.id, { onDelete: 'cascade' }),
productId: integer('product_id')
.notNull()
.references(() => products.id, { onDelete: 'cascade' }),
});
Domain
Subdomains
Functions
Dependencies
- sqlite-core
Imported By
Source
Frequently Asked Questions
What does sqliteSchema.ts do?
sqliteSchema.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 sqliteSchema.ts?
sqliteSchema.ts defines 1 function(s): employees.
What does sqliteSchema.ts depend on?
sqliteSchema.ts imports 1 module(s): sqlite-core.
What files import sqliteSchema.ts?
sqliteSchema.ts is imported by 1 file(s): sqliteTest.ts.
Where is sqliteSchema.ts in the architecture?
sqliteSchema.ts is located at drizzle-seed/tests/northwind/sqliteSchema.ts (domain: DrizzleORM, subdomain: RelationalQuery, 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