db.js icon indicating copy to clipboard operation
db.js copied to clipboard

Import / Export Database

Open joewashear007 opened this issue 9 years ago • 4 comments

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

joewashear007 avatar Mar 13 '15 15:03 joewashear007

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.

aaronpowell avatar Mar 16 '15 22:03 aaronpowell

If implemented, this might be nicely added to its own module as suggested at https://github.com/treojs/idb-schema/issues/6#issuecomment-203859197

brettz9 avatar Mar 31 '16 16:03 brettz9

Wow that idb-schema library looks very cool.

mikemorton avatar Apr 01 '16 20:04 mikemorton

@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).

brettz9 avatar Apr 01 '16 20:04 brettz9