Closed Templarian closed 9 years ago
Already exists. https://github.com/bramski/angular-indexedDB#usage. And there are lots of examples.
@bramski Correct me if I'm wrong, but that's during the config or start of the project.
I for instance construct the IndexedDB as the user selects what data they want to import (so API responses determine the schema).
Yes I see. No angular-indexed-db does not support this. In general what you are suggesting is somewhat tricky and I would recommend that you just consider creating all the stores for all possible configs as they are quite cheap to create. This will save you nightmares of ensuring that the database is closed and all transactions are finished before try and run an upgrade. Good luck!
No problem, yea, it seemed like a very specific use case. This solution works, but I'm going to assume that 99% of users will not be modifying the IndexedDB after run (this is the first time I've ever run into a case like this).
Thanks for taking over the project. It's awesome.
So, for a project that dynamically adds object stores it could be useful to have a
upgradeDatabase
method on$indexDB
. There may be a better way (docs seem rather light on examples).A really basic idea of how this could be used is below:
I've never used coffeescript, but I'm sure I could guess my way through it and do a pull request if you agree this would be useful.