Skip to content

Commit

Permalink
Delete previous idb and upgrade for v3 (#1112)
Browse files Browse the repository at this point in the history
* Delete previous idb and upgrade for v3

* Less than 2, delete previous object store

* Handle no object store
  • Loading branch information
Matt Gaunt authored Dec 8, 2017
1 parent fab630f commit a53b3d2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/workbox-precaching/models/PrecachedDetailsModel.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,15 @@ class PrecachedDetailsModel {
*/
constructor(cacheName) {
this._cacheName = cacheNames.getPrecacheName(cacheName);
this._db = new DBWrapper(`workbox-precaching`, 1, {
this._db = new DBWrapper(`workbox-precaching`, 2, {
onupgradeneeded: (evt) => {
if (evt.oldVersion < 2) {
try {
evt.target.result.deleteObjectStore('workbox-precaching');
} catch (err) {
// NOOP
}
}
evt.target.result.createObjectStore(DB_STORE_NAME);
},
});
Expand Down

0 comments on commit a53b3d2

Please sign in to comment.