In my ionic 3 app I’m storing data in a pouchDB database (6.3.4) using the webSQL adapter. After update to ionic 4 using a new project, I’m trying to access the data in the database. But it is empty. What’s the problem? How can I use the data of my old app?
I use nearly the same code to initialize the database in Ionic 3 and in Ionic 4. But after updating the app on my device there’s no document left in the database. The only structural difference is, that in Ionic 4 I’m using a promise:
Imports in both cases:
import PouchDB from 'pouchdb';
import cordovaSqlitePlugin from 'pouchdb-adapter-cordova-sqlite';
PouchDB.plugin(cordovaSqlitePlugin);
Ionic 3:
initDB() {
this.db = new PouchDB('TeacherBook.db', { adapter: 'websql' });
_allData = undefined;
}
Ionic 4:
initDB() {
return new Promise(resolve => {
this.db = new PouchDB('TeacherBook.db', { adapter: 'websql'});
_allData = undefined;
resolve(true);
})
}
I don’t know what’s the problem. Can you help me, please? Thanks in advance!