Hi,
for the update of an ionic app from 5.3.4 to 6.1.13, also the ionic storage package changed from @ionic/storage
(version 2) to @ionic/storage-angular
(version 3). The whole app works fine, however I am unable to get already saved data with the new storage-module. Saving / retrieving new data with the new storage module works just fine!
Tested with Andoird and IOS
Old App (Ionic 5)
Saving / retrieving data works fine:
package.json:
"@angular/core": "~9.1.6",
"@ionic/angular": "^5.3.4",
"@ionic/storage": "^2.3.1",
app.module:
import { IonicStorageModule } from '@ionic/storage';
@NgModule({
...
imports: [
IonicModule.forRoot(),
IonicStorageModule.forRoot({
name: '__mydb',
driverOrder: ['sqlite', 'websql', 'indexeddb'],
}),
...
New App (Ionic 6, new angular-storage module)
Saving / retrieving new data works fine, retrieving data that was stored using the old storage module (same key) does not work: it’s null
package.json:
"@angular/core": "^14.0.5",
"@ionic/angular": "^6.1.13",
"@ionic/storage-angular": "^3.0.6",
app.module:
import { Drivers } from '@ionic/storage';
import { IonicStorageModule } from '@ionic/storage-angular';
@NgModule({
...
imports: [
IonicStorageModule.forRoot({
name: '__mydb',
driverOrder: [CordovaSQLiteDriver._driver, Drivers.IndexedDB, Drivers.LocalStorage],
}),
...
New App (Ionic 6, old storage module)
I even tried to downgrade to the old storage package (same version as in old app), still I am unable to retrieve data that was saved using the old app:
package.json:
"@angular/core": "^14.0.5",
"@ionic/angular": "^6.1.13",
"@ionic/storage": "2.3.1",
app.module:
import { IonicStorageModule } from '@ionic/storage';
@NgModule({
...
imports: [
IonicStorageModule.forRoot({
name: '__mydb',
driverOrder: ['sqlite', 'websql', 'indexeddb'],
}),
...
I would appreciate any insights / tips, the database name did not change and the data is still there, because if I install the old version again all data is retrieved successfully.
But If I try to get the data (same key) with the updated ionic app, regardless of old or new storage package, I can’t retrieve the data…