迁移播放记录到新数据结构,新增自动清理播放记录

This commit is contained in:
mtvpls
2025-12-30 21:00:10 +08:00
parent 6ad268d319
commit f43d9c7d0e
7 changed files with 381 additions and 29 deletions
+8
View File
@@ -182,6 +182,7 @@ export class DbManager {
oidcSub?: string;
enabledApis?: string[];
created_at: number;
playrecord_migrated?: boolean;
} | null> {
if (typeof (this.storage as any).getUserInfoV2 === 'function') {
return (this.storage as any).getUserInfoV2(userName);
@@ -259,6 +260,13 @@ export class DbManager {
return [];
}
// ---------- 播放记录迁移 ----------
async migratePlayRecords(userName: string): Promise<void> {
if (typeof (this.storage as any).migratePlayRecords === 'function') {
await (this.storage as any).migratePlayRecords(userName);
}
}
// ---------- 数据迁移 ----------
async migrateUsersFromConfig(adminConfig: AdminConfig): Promise<void> {
if (typeof (this.storage as any).createUserV2 !== 'function') {