model ProductVariant { id Int @id @default(autoincrement()) name String @db.VarChar(255) basePrice Decimal @db.Decimal(15, 2) salePrice Decimal @db.Decimal(15, 2) description String? @db.Text barcode String? @unique() @db.VarChar(100) imageUrl String? @db.VarChar(255) unit String? @db.VarChar(10) quantity Decimal? @default(0.00) @db.Decimal(10, 0) alertQuantity Decimal? @default(5.00) @db.Decimal(10, 0) isActive Boolean @default(true) isFeatured Boolean @default(false) createdAt DateTime @default(now()) @db.Timestamp(0) updatedAt DateTime @updatedAt @db.Timestamp(0) deletedAt DateTime? @db.Timestamp(0) productId Int product Product @relation("Product_Variant", fields: [productId], references: [id], onUpdate: NoAction) @@index([productId], map: "Product_Variants_productId_fkey") @@map("Product_Variants") } model Product { id Int @id @default(autoincrement()) name String @db.VarChar(255) description String? @db.Text sku String? @unique() @db.VarChar(100) barcode String? @unique() @db.VarChar(100) createdAt DateTime @default(now()) @db.Timestamp(0) updatedAt DateTime @updatedAt @db.Timestamp(0) deletedAt DateTime? @db.Timestamp(0) brandId Int? categoryId Int? salePrice Decimal @default(0.00) @db.Decimal(15, 0) minimumStockAlertLevel Decimal @default(1.00) @db.Decimal(10, 0) inventoryTransferItems InventoryTransferItem[] @relation("InventoryTransferItem_Product") variants ProductVariant[] @relation("Product_Variant") brand ProductBrand? @relation("Product_Brand", fields: [brandId], references: [id], onUpdate: NoAction) category ProductCategory? @relation("Product_Category", fields: [categoryId], references: [id], onUpdate: NoAction) purchaseReceiptItems PurchaseReceiptItem[] @relation("Product_PurchaseReceiptItems") stockAdjustments StockAdjustment[] @relation("Product_Stock_Adjustments") stockBalances StockBalance[] @relation("StockBalance_Product") stockMovements StockMovement[] @relation("StockMovement_Product") salesInvoiceItems SalesInvoiceItem[] @@index([brandId], map: "Products_brandId_fkey") @@index([categoryId], map: "Products_categoryId_fkey") @@map("Products") } model ProductBrand { id Int @id @default(autoincrement()) name String @db.VarChar(100) description String? @db.Text imageUrl String? @db.VarChar(255) createdAt DateTime @default(now()) @db.Timestamp(0) updatedAt DateTime @updatedAt @db.Timestamp(0) deletedAt DateTime? @db.Timestamp(0) products Product[] @relation("Product_Brand") @@map("Product_brands") } model ProductCategory { id Int @id @default(autoincrement()) name String @db.VarChar(100) description String? @db.Text imageUrl String? @db.VarChar(255) createdAt DateTime @default(now()) @db.Timestamp(0) updatedAt DateTime @updatedAt @db.Timestamp(0) deletedAt DateTime? @db.Timestamp(0) products Product[] @relation("Product_Category") @@map("Product_categories") }