db.js
db.js copied to clipboard
Import / Export Database
Would it be possible to make database import / export? I am working on a project that I will need to export a local indexed DB to a CSV.
I was thinking it would be nice to add this feature to you library. I think it should at least support JSON and CSV files.
Do you mind if I were to work on this and submit a pull request? I what syntax would you like something like this to have?
Thanks, Joe
The challenge I see with doing this in the box is that everyone's needs will be different. Is the JSON from a AJAX request? Do they want to do processing on the data before it's inserted? Does the data go into a single collection or multiple? What becomes the key?
I'm all for a PR being submitted though as you're likely to have a better idea on the approach as it's something you've got a need for.
If implemented, this might be nicely added to its own module as suggested at https://github.com/treojs/idb-schema/issues/6#issuecomment-203859197
Wow that idb-schema library looks very cool.
@mikemorton : I've got a branch commit already ready with it integrated (assuming the PRs it builds on top of are accepted), but I still want to add one more option to the branch before submitting the PR, namely to give you the alternative of using schema
to build the schema, but with subsequent versions expressable as (JSON Patch) JSON. This would allow keeping the declarative nature for versioning, though without the full capabilities of idb-schema (namely its ability to use addCallback
).