I found that Ionic 3 serves applications from file:// and Ionic 4 serves applications from http:// for iOS and Android. This means that the WebView for each platform has databases IndexedDB and WebSQL stored for different hosts. So if you upgrade your application from Ionic 3 to Ionic 4 and you’re using the default IndexedDB for Storage, then the persistent storage will be lost. I realized recently that those weren’t reliable ways of saving data anyway, so I was planning to migrate to Cordova SQLite based storage, but I was finding now that I also need to migrate the old raw files before the WebView can use them. And use a different directory structure for the WKWebView vs UIWebView change on iOS. I wasn’t able to find many people talking about this issue. Are most projects using Cordova SQLite based storage, so this isn’t an issue? Or is there a database migration plan that I’m missing?
I think I found the answer I was looking for in this open issue: https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/181
If this was the solution, please mark it as “Solution” to make the Question “finished”.
Cheers
Unkn0wn0x
Thanks. It’s not exactly a satisfying answer, “Unfortunately, we’re not really sure if there’s a way to transition over data. We recommend you doing that yourself by releasing an update that moves your data off of indexeddb/local storage and into sqlite, and then when upgrading the webview you can either pull that data back, or better yet, keep using sqlite instead.”
I hate to call it a “solution”, but I’ll check the box anyway…the issue can track it.