Files
bewell-in-ua/lib/db/prisma/schema/category.prisma
2025-02-07 08:34:42 +02:00

41 lines
1.5 KiB
Plaintext

model Category {
id Int @id @default(autoincrement())
status Boolean? @default(false)
position Int? @default(0) @db.UnsignedSmallInt
image String? @db.VarChar(384)
storeId Int @map("store_id")
locales CategoryLocale[]
createdAt DateTime @default(now()) @map("created_at")
categoriesOnProducts CategoriesOnProducts[]
@@map("categories")
}
model CategoryLocale {
id Int @id @default(autoincrement())
category Category @relation(fields: [categoryId], references: [id])
categoryId Int @map("category_id")
lang Lang @default(uk)
title String @db.VarChar(384)
slug String? @unique @db.VarChar(384)
shortTitle String? @map("short_title")
description String? @db.Text
// content String? @db.MediumText
// extendedData Json? @map("extended_data") @db.Json
@@unique([categoryId, lang])
@@map("category_locales")
}
model CategoriesOnProducts {
store Store @relation(fields: [storeId], references: [id])
storeId Int @default(1) @map("store_id")
product Product @relation(fields: [productId], references: [id])
productId Int @map("product_id")
category Category @relation(fields: [categoryId], references: [id])
categoryId Int @map("category_id")
@@id([storeId, productId, categoryId])
@@map("categories_on_products")
}