Skip to content

Commit

Permalink
Merge pull request #7 from NextFaze/master
Browse files Browse the repository at this point in the history
Compatability with Cordova-sqlite-storage 1.2.0
  • Loading branch information
thgreasi committed Apr 16, 2016
2 parents ff12d4c + 8bef9be commit 4a2c724
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
[![npm](https://img.shields.io/npm/dm/localforage-cordovasqlitedriver.svg)](https://www.npmjs.com/package/localforage-cordovasqlitedriver)
SQLite driver for [Cordova](https://cordova.apache.org/) apps using [localForage](https://github.com/mozilla/localForage).

## upgrade warning

*BREAKING CHANGE*
The default storage location for SQLite has changed in newer versions of [Cordova SQLite storage plugin](https://github.com/litehelpers/Cordova-sqlite-storage/)

*WARNING*: The new "default" location value is NOT the same as the old default location and would break an upgrade for an app that was using the old default value (0) on iOS.

If you are upgrading to a newer version of `localForage-cordovaSQLiteDriver` you need to verify where your previous storage location was and update the `location` property of the localForage database. Otherwise the default is `'default'`. This is to avoid breaking the iCloud Design Guide. See [here](https://github.com/litehelpers/Cordova-sqlite-storage#important-icloud-backup-of-sqlite-database-is-not-allowed) for further details.

## requirements

* [Cordova](https://cordova.apache.org/)/[ionic](http://ionicframework.com/)
Expand Down
12 changes: 9 additions & 3 deletions src/localforage-cordovasqlitedriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Copyright (c) 2015 Mozilla
* Licensed under Apache 2.0 license.
*
*
* ======================================
*
* base64-arraybuffer
Expand Down Expand Up @@ -113,8 +113,14 @@
// Open the database; the openDatabase API will automatically
// create it for us if it doesn't exist.
try {
dbInfo.db = openDatabase(dbInfo.name, String(dbInfo.version),
dbInfo.description, dbInfo.size);
dbInfo.location = dbInfo.location || 'default';
dbInfo.db = openDatabase({
name: dbInfo.name,
version: String(dbInfo.version),
description: dbInfo.description,
size: dbInfo.size,
location: dbInfo.location
});
} catch (e) {
reject(e);
}
Expand Down

0 comments on commit 4a2c724

Please sign in to comment.