dexie / Dexie.js

A Minimalistic Wrapper for IndexedDB
https://dexie.org
Apache License 2.0
11.49k stars 642 forks source link

index accidentally deleted after migrate in Safari 9.1.2 #562

Open bolasblack opened 7 years ago

bolasblack commented 7 years ago

This is repro code:

const db = new Dexie('hello-dexie')

db.version(1).stores({
  Preference: 'id, __account_id, &[key+__account_id]',
})

db.version(4).stores({
  Preference: 'id, __account_id, [key+__account_id]',
})

db.open().then(
  function(result) {
    console.log('success')
  },
  function(err) {
    console.error(err)
  }
)
  1. Create database with version 1 at first (delete version 4 scheme)
  2. migrate database to version 4
  3. check index __account_id, you will find it disappeared
bolasblack commented 7 years ago

Seems safari will remove all other index when you called createIndex

dfahlander commented 7 years ago

Does the same code work in other browser? I know Safari 9.x is so buggy in regards to indexeddb that it is practically unusable. Use IndexeddbShim to make it work on Safari 9.

bolasblack commented 7 years ago

Other browser didn't encountered this bug

bolasblack commented 7 years ago

Thanks for your reply, I will try to use IndexeddbShim to fix this bug 😂

dfahlander commented 7 years ago

Good to hear. :)