fix(mobile): catch database clone

This commit is contained in:
Stephen Zhou 2025-06-11 16:07:09 +08:00
parent fa99d6f266
commit b82da59a5f
No known key found for this signature in database
1 changed files with 5 additions and 1 deletions

View File

@ -26,7 +26,11 @@ export async function migrateDb(): Promise<void> {
await migrate(db, migrations)
} catch (error) {
console.error("Failed to migrate database:", error)
await sqlite.closeAsync()
try {
await sqlite.closeAsync()
} catch {
/* empty */
}
await SQLite.deleteDatabaseAsync(SQLITE_DB_NAME)
sqlite = SQLite.openDatabaseSync(SQLITE_DB_NAME)
initializeDb()