@@ -1000,12 +1000,29 @@ model CommonStoreCategory {
|
||||
parent CommonStoreCategory? @relation("StoreCategoryTree", fields: [parentId], references: [id], onDelete: Restrict)
|
||||
children CommonStoreCategory[] @relation("StoreCategoryTree")
|
||||
stores Store[]
|
||||
storeLinks StoreCategoryLink[]
|
||||
|
||||
@@index([parentId, sort])
|
||||
@@index([status])
|
||||
@@map("common_store_category")
|
||||
}
|
||||
|
||||
/// 门店 ↔ 二级分类多对多;store.category_id 保留主分类(排序第一)
|
||||
model StoreCategoryLink {
|
||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
storeId BigInt @map("store_id") @db.UnsignedBigInt
|
||||
categoryId BigInt @map("category_id") @db.UnsignedBigInt
|
||||
priority Int @default(0)
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
|
||||
|
||||
store Store @relation(fields: [storeId], references: [id], onDelete: Cascade)
|
||||
category CommonStoreCategory @relation(fields: [categoryId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([storeId, categoryId])
|
||||
@@index([categoryId])
|
||||
@@map("store_category_link")
|
||||
}
|
||||
|
||||
model CommonPromoCode {
|
||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
code String @unique @db.VarChar(32)
|
||||
@@ -1542,6 +1559,7 @@ model Store {
|
||||
packages StorePackage[]
|
||||
packageChangeRequests StorePackageChangeRequest[]
|
||||
infoChangeRequests StoreInfoChangeRequest[]
|
||||
categoryLinks StoreCategoryLink[]
|
||||
|
||||
@@index([cityId, status])
|
||||
@@index([partnerAccountId])
|
||||
|
||||
Reference in New Issue
Block a user