Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multiple DBs #14

Closed
Terreii opened this issue May 6, 2020 · 1 comment · Fixed by #29
Closed

Add support for multiple DBs #14

Terreii opened this issue May 6, 2020 · 1 comment · Fixed by #29
Assignees
Labels
enhancement New feature or request released Released. Semantic-Release will add this label.

Comments

@Terreii
Copy link
Owner

Terreii commented May 6, 2020

Summary

It is not uncommon to use multiple DB. Often the local db and the remote db.
It would be a good idea to have access to multiple DBs contexts with usePouchDB.

Desired Behavior

Every hook should have an additional optional option to specify the db to use. If this option is omitted, then the closest DB in the component-tree should be used (the default).

Possible Solution

The context Provider should check if there is already an context. And if it exists, then include all its DBs into its context, and overwrite the default one.
The DBs can then be selected using their names.

Additional context

This would allow many new use-cases:

  • Have a local db and a remote db. The local is used the most. But the remote can be accessed by the log-in-component.
  • Start with using a remote db. Once the local db did sync and all views are indexed, switch to the local db.
  • Use a temporary db (in memory only). To check out the app. And once the user signs up, then create a local and remote db and sync the temp to them.
@Terreii Terreii added the enhancement New feature or request label May 6, 2020
@Terreii Terreii self-assigned this Jun 22, 2020
@Terreii
Copy link
Owner Author

Terreii commented Jun 25, 2020

🎉 This issue has been resolved in version 1.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Terreii Terreii added the released Released. Semantic-Release will add this label. label Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released Released. Semantic-Release will add this label.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant