20 lines
1,019 B
TypeScript
20 lines
1,019 B
TypeScript
import { integer, sqliteTable, text, real } from 'drizzle-orm/sqlite-core'
|
|
import { distributors } from './distributors'
|
|
import { units } from './units'
|
|
|
|
export const products = sqliteTable('products', {
|
|
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
name: text('name').notNull(),
|
|
brand: text('brand').notNull(),
|
|
category: text('category').notNull(),
|
|
distributorId: integer('distributor_id').references(() => distributors.id),
|
|
unitId: integer('unit_id').notNull().references(() => units.id),
|
|
procuredPrice: real('procured_price').notNull(),
|
|
mrp: real('mrp').notNull(),
|
|
sellingPrice: real('selling_price').notNull(),
|
|
quantity: integer('quantity').notNull().default(0),
|
|
reorderLevel: integer('reorder_level').notNull().default(0),
|
|
unitsPerStrip: integer('units_per_strip'),
|
|
hideProductFromPublic: integer('hide_product_from_public', { mode: 'boolean' }).notNull().default(false),
|
|
hidePriceFromPublic: integer('hide_price_from_public', { mode: 'boolean' }).notNull().default(false),
|
|
})
|