Open marionava opened 4 years ago
I hope this helps you. SQLite Plugin does not work on the browser. Until I tested it with my iOS device and made a few slight changes to my code it worked perfectly, but only on a real device. This is what I changed on my code:
createPouchDB() {
PouchDB.plugin(SQLitePlugin);
this.db = new PouchDB<Item>('items.db', {
adapter: 'cordova-sqlite',
iosDatabaseLocation: 'Library',
androidDatabaseImplementation: 2
});
}
SQLite Plugin does not work on the browser.
Correct. It would be ideal if PouchDB could be adapted to use IndexedDB on the browser and plugin on Cordova.
The code changes look fine but do have some limitations. My understanding is that the Library directory would be backed up to iCloud, which is generally not desired for reasons that I have already documented. The androidDatabaseImplementation option was renamed, and the old name was deprecated. I generally recommend avoiding this option anyway for multiple reasons including the risk of missing recent security updates and the likely lack of extra safety that I have implemented against potential database corruption.
Hi,
On Ionic have installed the cordova-sqlite-storage running the command
npm install --save cordova-sqlite-storage
but still getting this error.PouchDB error: you must install a SQLite plugin in order for PouchDB to work on this platform. Options:
https://github.com/nolanlawson/cordova-plugin-sqlite-2 https://github.com/litehelpers/Cordova-sqlite-storage https://github.com/Microsoft/cordova-plugin-websql
This is my code on a service