Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Bug 1225339 - Properly upgrade visits datastore
Browse files Browse the repository at this point in the history
  • Loading branch information
daleharvey committed Nov 26, 2015
1 parent 6f4aa7b commit ee3bf82
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions apps/search/js/places_idb.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,22 @@
upgradeSchema: function(e) {
var db = e.target.result;
var fromVersion = e.oldVersion;

if (fromVersion < 1) {
var places = db.createObjectStore(PLACES_STORE, { keyPath: 'url' });
places.createIndex('frecency', 'frecency', { unique: false });
places.createIndex('visited', 'visited', { unique: false });
}

if (fromVersion < 3) {
if (fromVersion < 2) {
asyncStorage.removeItem('latest-revision');
var visits = db.createObjectStore(VISITS_STORE, { keyPath: 'date' });
visits.createIndex('date', 'date', { unique: true });
}

if (fromVersion < 2) {
asyncStorage.removeItem('latest-revision');
visits.createIndex('date', 'date', { unique: true });
}

if (fromVersion < 3) {
visits.createIndex('url', 'url', { unique: false });
}
if (fromVersion < 3) {
var oStore = db.transaction.objectStore(VISITS_STORE);
oStore.createIndex('url', 'url', { unique: false });
}
},

Expand Down

0 comments on commit ee3bf82

Please sign in to comment.