数据迁移支持电子书和漫画

This commit is contained in:
mtvpls
2026-04-29 16:09:25 +08:00
parent 5d794aec52
commit 4b8bf68179
5 changed files with 135 additions and 12 deletions
+10 -4
View File
@@ -2796,9 +2796,6 @@ export class PostgresStorage implements IStorage {
'book_shelf',
'book_read_records',
'skip_configs',
'music_play_records',
'music_playlists',
'music_playlist_songs',
'music_v2_history',
'music_v2_playlists',
'music_v2_playlist_items',
@@ -2811,7 +2808,16 @@ export class PostgresStorage implements IStorage {
];
for (const table of tables) {
await this.db.prepare(`DELETE FROM ${table}`).run();
try {
await this.db.prepare(`DELETE FROM ${table}`).run();
} catch (err) {
const message = err instanceof Error ? err.message : String(err);
if (message.includes('no such table') || message.includes('does not exist')) {
console.warn('PostgresStorage.clearAllData warning:', table, message);
continue;
}
throw err;
}
}
} catch (err) {
console.error('PostgresStorage.clearAllData error:', err);