feat(db): ads 写权威表与 ads_ov 投影表(含迁移)

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-28 22:43:25 +08:00
parent 001d3aaf73
commit 726f6a1be8
4 changed files with 75 additions and 0 deletions
+15
View File
@@ -183,6 +183,21 @@ model embed_slots_ov {
updatedAt DateTime @updatedAt @db.DateTime(6)
}
// —— 副本域:ads_ov(cn ads 的展示投影,2026-09-28)——
// 无墓碑——ad.deleted 墓碑与 enabled=false 快照都表达为「删行」(公开不可见);
// createdAt 为 cn 原值(排序 tie-break,非本机生成)。
model ads_ov {
adId String @id @db.VarChar(32)
imageObjectKey String @db.VarChar(512)
linkUrl String @db.VarChar(2048)
sortOrder Int
albumIds Json?
entityVersion Int
createdAt DateTime @db.DateTime(6)
updatedAt DateTime @db.DateTime(6)
@@index([sortOrder, createdAt])
}
// —— 统计回传队列:outbox_stat_events(ov→cn,Task 9 消费)——
// 与 cn outbox_events 同构的发送位:sentAt 为空即重发(中断恢复),statVersion
// 让 cn 侧「仅更高版本替换」幂等。total 恒为权威快照值(非增量)。