@@ -4,9 +4,10 @@ import type {
44 FlashcardDeck , Flashcard , FlashcardReview ,
55 FeynmanNote , FeynmanSummary , FeynmanWeakPoint ,
66 OperationLog , AppSettings , SyncConflict , OfflineQueueItem ,
7- StudyCheckIn , Achievement , PomodoroGoal , WindowCapture ,
7+ StudyCheckIn , Achievement , PomodoroGoal , WindowCapture , WindowCaptureSegment ,
88 Consent , UserProfile , Inspiration , SearchIndexEntry , RitualRecord
99} from '@/types/models' ;
10+ import type { DeepSeaDiscovery , CoralRecord , StreakState } from '@/features/retention/types' ;
1011import type { ClassroomNote } from './classroomNoteStore' ;
1112import type { CRDTDocRecord , CRDTChangeRecord } from '@/lib/sync/crdtEngine' ;
1213
@@ -49,6 +50,10 @@ export class EntropyDecreaseDatabase extends Dexie {
4950 crdtChanges ! : Table < CRDTChangeRecord , number > ;
5051 ritualRecords ! : Table < RitualRecord , string > ;
5152 pomodoroPresets ! : Table < PomodoroPreset , string > ;
53+ deepSeaDiscoveries ! : Table < DeepSeaDiscovery , string > ;
54+ coralEcosystem ! : Table < CoralRecord , string > ;
55+ streakState ! : Table < StreakState , string > ;
56+ windowCaptureSegments ! : Table < WindowCaptureSegment , string > ;
5257
5358 constructor ( ) {
5459 // 数据库名 'keban' 不可修改(存量用户数据),见文件头 @ai-context
@@ -277,6 +282,20 @@ export class EntropyDecreaseDatabase extends Dexie {
277282 this . version ( 17 ) . stores ( {
278283 pomodoroPresets : 'id, sortOrder, builtin, createdAt' ,
279284 } ) ;
285+
286+ // v0.29.0: 留存机制 — 深海发现 / 珊瑚生态 / 防断裂 streak
287+ this . version ( 18 ) . stores ( {
288+ deepSeaDiscoveries : 'id, type, rarity, discoveredAt, sourceType' ,
289+ coralEcosystem : 'id, type, health, plantedAt, depth' ,
290+ streakState : 'id, lastActiveDate' ,
291+ } ) ;
292+
293+ // P2-14: 采集片段独立表 — 将 segments 从 windowCaptures 内嵌数组拆出,
294+ // addSegment 由全量读改写(O(n)+竞态)变为原子追加;旧会话内嵌 segments
295+ // 仍可读(captureStore.getSegments 回退),无需数据迁移。
296+ this . version ( 19 ) . stores ( {
297+ windowCaptureSegments : 'id, sessionId, timestamp' ,
298+ } ) ;
280299 }
281300}
282301
0 commit comments