Closed brettz9 closed 8 years ago
Hi! This is good idea. In free time I'm currently working on treo@0.6, which uses https://github.com/treojs/idb-schema So API for this feature might be:
var schema = new Schema()
.version(1)
.addStore('books', { key: 'isbn' })
.addIndex('byTitle', 'title', { unique: true })
.callback(fn1)
.version(2)
.getStore('books')
.addIndex('byDate', ['year', 'month'])
.callback(fn2)
So you use .callback()
method to set custom method in the end of version execution.
Sounds good. And as I've been drawn to the convenient query syntax of db.js, it is nice to see idb-schema as a separate library which I may try to work into db.js.
Yep, it's designed to work smoothly with other libraries :)
Hi,
I was wondering whether you'd be open to a PR for accepting a callback as an optional second argument to
version()
to be executed duringupgradeneeded
(I suppose after any store/index actions for the version).I'm just wary of getting locked in to a wrapper which can't let me fully express what the original API could.
Thanks!