model Product { id Int @id @default(autoincrement()) type ProductType? @default(DIETARY_SUPPLEMENT) image String? @db.VarChar(512) // vendor Vendor @relation(fields: [vendorId], references: [id]) // vendorId Int locales ProductLocale[] categoriesOnProducts CategoriesOnProducts[] resources ProductResource[] toStore ProductToStore[] attribute ProductAttribute[] ingradient ProductIngradient[] form FormsOfRelease[] createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(3) updatedAt DateTime? @default(dbgenerated("NULL DEFAULT NULL ON UPDATE current_timestamp(3)")) @map("updated_at") @db.Timestamp(3) @@map("products") } model ProductLocale { id Int @id @default(autoincrement()) lang Lang @default(uk) slug String? @db.VarChar(384) title String @db.VarChar(384) shortTitle String? @map("short_title") headingTitle String? @map("heading_title") description String? @db.MediumText content String? @db.MediumText instruction String? @db.MediumText product Product @relation(fields: [productId], references: [id]) productId Int @map("product_id") meta Meta? @relation(fields: [metaId], references: [id]) metaId Int? @map("meta_id") @@unique([productId, slug, lang]) @@map("product_locale") } model ProductResource { id Int @id @default(autoincrement()) type ResourceType mimeType String? @map("mime_type") isFeature Boolean? @default(false) filesize Int? @db.UnsignedInt width Int? @db.UnsignedSmallInt height Int? @db.UnsignedSmallInt quality Float? @db.Float signature String @db.Char(64) uri String @db.VarChar(1024) title String? @db.VarChar(255) description String? @db.Text meta Json? @db.Json productId Int? @map("product_id") product Product? @relation(fields: [productId], references: [id]) createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(3) updatedAt DateTime? @default(dbgenerated("NULL DEFAULT NULL ON UPDATE current_timestamp(3)")) @map("updated_at") @db.Timestamp(3) @@unique([productId, signature]) @@map("product_resources") } model ProductIngradient { id Int @id @default(autoincrement()) name String altNames String? @map("alt_names") genericName String? @map("generic_name") activeSubstance String? @map("active_substance") excipients String? units Unit amount Decimal @db.Decimal(7, 3) product Product? @relation(fields: [productId], references: [id]) productId Int? @map("product_id") @@map("product_ingradients") } model ProductAttribute { id Int @id @default(autoincrement()) lang Lang @default(uk) key String text String @db.MediumText productId Int? @map("product_id") product Product? @relation(fields: [productId], references: [id]) @@unique([lang, key, productId]) @@map("product_attributes") } model ProductToStore { id Int @id @default(autoincrement()) position Int @default(0) published Boolean @default(false) available Boolean @default(false) price Decimal @default(0) @db.Decimal(7, 2) pricePromotional Decimal @default(0) @map("price_promotional") @db.Decimal(7, 2) productId Int @map("product_id") storeId Int @map("store_id") product Product @relation(fields: [productId], references: [id]) createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(3) @@unique([storeId, productId]) @@map("product_to_store") } // model Vendor { // id Int @id @default(autoincrement()) // slug String? @unique @default(uuid()) @db.VarChar(255) // label String? // origin String? // locale VendorLocale[] // product Product[] // createdAt DateTime @default(now()) @map("created_at") @db.Timestamp(3) // updatedAt DateTime? @default(dbgenerated("NULL DEFAULT NULL ON UPDATE current_timestamp(3)")) @map("updated_at") @db.Timestamp(3) // // @@map("vendors") // } // // model VendorLocale { // id Int @id @default(autoincrement()) // vendor Vendor? @relation(fields: [vendorId], references: [id]) // vendorId Int? @map("vendor_id") // lang Lang @default(uk) // title String @db.VarChar(384) // slug String? @db.VarChar(384) // shortTitle String? @map("short_title") // description String? @db.Text // content String? @db.MediumText // meta Meta? @relation(fields: [metaId], references: [id]) // metaId Int? @map("meta_id") // // @@unique([vendorId, slug, lang]) // @@map("vendor_locale") // } model FormsOfRelease { id Int @id @default(autoincrement()) quantity Int @db.UnsignedSmallInt package Package additionalInfo String? @map("additional_info") product Product? @relation(fields: [productId], references: [id], onDelete: Cascade) productId Int? @map("product_id") @@map("forms_of_release") }