Sqlite DB getting cleared by iOS when storage is full

Our team is using sqlite for storage on an Ionic v1 app. It appears that whenever the storage fills up on iOS, the operating system is deleting the database. Ideally, we’d like this data to be persistent.

Initially, our code to create the DB looked like this:

self.db = window.openDatabase('example', '1.0', 'ExampleDb', 3*1024*1024);

After doing some research, I decided to try this plugin: https://github.com/litehelpers/Cordova-sqlite-storage

The code now looks like this:

self.db = $cordovaSQLite.openDatabase({name: 'example', location: 'default'});

I have tried using all of the provided locations, default, Library, and Documents but the database is still being removed by the OS. Is there anything I’m missing about persistent storage?

I’ve done quite a bit of research on this issue to no avail. Any help would be greatly appreciated. Thank you for your time!


@TonyLuntWS I’m also facing the same issue in my app. Did you found any solution for this issue?

1 Like

i’m able to solve this issue by using pouchdb and pouchdb-adapter-cordova-sqlite.

Also i’m using cordova-plugin-sqlite-2.

You can refer this example project for the demo code