feat(api): good family_id column with backfill

This commit is contained in:
yeuimu
2026-08-28 13:34:42 +08:00
parent ba3c6d2d4f
commit b4b9fbbe60
3 changed files with 67 additions and 0 deletions
+4
View File
@@ -212,6 +212,7 @@ model Position {
model Good {
id BigInt @id @default(autoincrement()) @map("good_id")
originGoodId BigInt @map("origin_good_id")
familyId BigInt? @map("family_id")
countryId BigInt @map("country_id")
categoryId BigInt @map("category_id")
tagId BigInt? @map("tag_id")
@@ -223,6 +224,7 @@ model Good {
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6)
originGood OriginGood @relation(fields: [originGoodId], references: [id], onDelete: Restrict, onUpdate: NoAction)
family ProductFamily? @relation(fields: [familyId], references: [id], onDelete: SetNull, onUpdate: NoAction)
country Country @relation(fields: [countryId], references: [id], onDelete: Restrict, onUpdate: NoAction)
category Category @relation(fields: [categoryId], references: [id], onDelete: Restrict, onUpdate: NoAction)
tag Tag? @relation(fields: [tagId], references: [id], onDelete: SetNull, onUpdate: NoAction)
@@ -231,6 +233,7 @@ model Good {
mergedOriginGoods GoodOriginGood[]
@@index([originGoodId])
@@index([familyId])
@@index([countryId])
@@index([categoryId])
@@index([tagId])
@@ -292,6 +295,7 @@ model ProductFamily {
originGoods OriginGood[]
priceOverrides FamilyPriceOverride[]
goods Good[]
country Country? @relation(fields: [countryId], references: [id], onDelete: SetNull, onUpdate: NoAction)
category Category? @relation(fields: [categoryId], references: [id], onDelete: SetNull, onUpdate: NoAction)