model ProductVariant { id Int @id @default(autoincrement()) name String @db.VarChar(255) basePrice Decimal @db.Decimal(10, 2) salePrice Decimal @db.Decimal(10, 2) description String? @db.Text barcode String? @unique(map: "products_barcode_unique") @db.VarChar(100) imageUrl String? @db.VarChar(255) unit String? @db.VarChar(10) quantity Decimal? @default(0.00) @db.Decimal(10, 2) alertQuantity Decimal? @default(5.00) @db.Decimal(10, 2) 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(map: "products_sku_unique") @db.VarChar(100) barcode String? @unique(map: "products_barcode_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(10, 2) inventoryTransferItems InventoryTransferItem[] @relation("InventoryTransferItem_Product") // productCharges ProductCharge[] @relation("Product_Charges") 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") salesInvoiceItems SalesInvoiceItem[] @relation("Product_SalesInvoiceItems") stockAdjustments StockAdjustment[] @relation("Product_Stock_Adjustments") stockBalances StockBalance[] @relation("StockBalance_Product") stockMovements StockMovement[] @relation("StockMovement_Product") @@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") }