Skip to content
Snippets Groups Projects
Commit 1ff7728d authored by Jono Wenger's avatar Jono Wenger
Browse files

Merge remote-tracking branch 'origin/release' into release

parents 0f4b067e 2fba0bed
No related branches found
No related tags found
1 merge request!60Revert "Fail a test to be sure it works"
...@@ -13,7 +13,6 @@ import ( ...@@ -13,7 +13,6 @@ import (
"syscall/js" "syscall/js"
"github.com/hack-pad/go-indexeddb/idb" "github.com/hack-pad/go-indexeddb/idb"
"github.com/pkg/errors"
jww "github.com/spf13/jwalterweatherman" jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/channels" "gitlab.com/elixxir/client/channels"
...@@ -62,19 +61,24 @@ func newWASMModel(databaseName string, cb MessageReceivedCallback) ( ...@@ -62,19 +61,24 @@ func newWASMModel(databaseName string, cb MessageReceivedCallback) (
openRequest, _ := idb.Global().Open(ctx, databaseName, currentVersion, openRequest, _ := idb.Global().Open(ctx, databaseName, currentVersion,
func(db *idb.Database, oldVersion, newVersion uint) error { func(db *idb.Database, oldVersion, newVersion uint) error {
if oldVersion == newVersion { if oldVersion == newVersion {
jww.INFO.Printf("IndexDb version is current: v%d", newVersion) jww.INFO.Printf("IndexDb version is current: v%d",
newVersion)
return nil return nil
} }
jww.INFO.Printf( jww.INFO.Printf("IndexDb upgrade required: v%d -> v%d",
"IndexDb upgrade required: v%d -> v%d", oldVersion, newVersion) oldVersion, newVersion)
if oldVersion == 0 && newVersion == 1 { if oldVersion == 0 && newVersion >= 1 {
return v1Upgrade(db) err := v1Upgrade(db)
if err != nil {
return err
}
oldVersion = 1
} }
return errors.Errorf("Invalid version upgrade path: v%d -> v%d", // if oldVersion == 1 && newVersion >= 2 { v2Upgrade(), oldVersion = 2 }
oldVersion, newVersion) return nil
}) })
// Wait for database open to finish // Wait for database open to finish
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment