feat(database): add database service abstraction with libsql/turso backend (#3472)

This commit is contained in:
Huang Xin
2026-03-05 02:01:35 +08:00
parent bd957a4eb8
commit 5273ef75dc
26 changed files with 2738 additions and 668 deletions
@@ -42,6 +42,7 @@ import { copyURIToPath, getStorefrontRegionCode } from '@/utils/bridge';
import { copyFiles } from '@/utils/files';
import { BaseAppService } from './appService';
import { DatabaseService } from '@/types/database';
import {
DATA_SUBDIR,
LOCAL_BOOKS_SUBDIR,
@@ -564,6 +565,12 @@ export class NativeAppService extends BaseAppService {
return await ask(message);
}
async openDatabase(path: string, base: BaseDir): Promise<DatabaseService> {
const fullPath = await this.resolveFilePath(path, base);
const { NativeDatabaseService } = await import('./database/nativeDatabaseService');
return NativeDatabaseService.open(`sqlite:${fullPath}`);
}
async migrate20251029() {
console.log('Running migration 20251029 to update paths in Images dir...');
const rootPath = await this.resolveFilePath('..', 'Data');