Re: [IndexedDB] JSON schema specification (#64)

I think this feature can be implemented in user land. IndexedDB API is low level enough to cover this case. For example I built [idb-schema](https://github.com/treojs/idb-schema) which can be combined with [idb-factory](https://github.com/treojs/idb-factory) for similar results:

```js
import Schema from 'idb-schema'
import { open } from 'idb-factory'

const schema = new Schema()
.version(1)
  .addStore('books', { key: 'isbn' })
  .addIndex('byTitle', 'title', { unique: true })
  .addIndex('byAuthor', 'author')
.version(2)
  .getStore('books')
  .addIndex('byDate', ['year', 'month'])
.version(3)
  .addStore('magazines')
  .addIndex('byPublisher', 'publisher')
  .addIndex('byFrequency', 'frequency')

open('mydb1', schema.version(), schema.callback).then((db) => {})
```

Handling of `onversionchange` should be done in app. For example having 2 tabs running on top of 2 different db versions can be an issue.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/IndexedDB/issues/64#issuecomment-184783174

Received on Tuesday, 16 February 2016 17:21:47 UTC