fix(store): handle version 0 with existing tables gracefully

Instead of throwing a schema mismatch error when version is 0 but tables already exist, set the version and return. This allows the database to properly initialize without erroring.
This commit is contained in:
weishu
2026-01-03 16:10:29 +08:00
parent a2c4315e99
commit 41e5ce8eca
+2 -1
View File
@@ -254,7 +254,8 @@ export class Store {
const currentVersion = this.getUserVersion()
if (currentVersion === 0) {
if (this.hasAnyUserTables()) {
throw this.buildSchemaMismatchError(currentVersion)
this.setUserVersion(SCHEMA_VERSION)
return
}
this.createSchema()