-
Notifications
You must be signed in to change notification settings - Fork 107
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
PouchDB Wrapper #28
Comments
@srbala there is no plan for this. PouchDB is a document database not SQL. The problem associated with PWA or Web browsers app is that no permanent storage is available. Before to answer, i look at pouchDB and try without success to create an app in typescript with Ionic5 and Angular9 and using pouchdb-adapter-cordova-sqlite and cordova-plugin-sqlite-2 (Could not import pouchdb) to create a service. Is your choice of pouchDB was related to have a PWA app synchronizing with a CouchDB server database or was it just to have an sql equivalent database for PWA or Web apps. In that case we may be looking to IndexedDB which is also not an sql driven database. So not sure that all SQLite statements could be implemented ? Can you tell me more about your concern |
Looking into the possibility of single ORM layer library (lets say capacitor-db-wrapper as CDW) which can work browser and app, detects and adopts based on availability or device type. This way app development has the calls CDW, CDW takes care of rest. https://pouchdb.com/adapters.html https://github.com/google/lovefield seems to alternate for SQL like statements and can be a bridge |
Having single code base for Mobile app vs PWA, when it comes to storage, it seems to be complicated. |
I don't know, but it looks like what you (@srbala) want is what the plugin was already doing (https://github.com/jepiqueau/capacitor-data-storage-sqlite), even before this sql plugin was created, maybe what you are requesting is the opposite of what I requested some time ago (jepiqueau/capacitor-data-storage-sqlite#11). I didn't deep into your request, so I may be completely wrong |
@srbala is the answer given by @fernandocode is good enough for what you are looking for ? As you close the issue i assume yes. Thanks anyway for looking at both plugins |
@jepiqueau Thanks for checking I think might have to do some more research and experiments. Mobile app development is fairly new world for me, trying to PWA in parallel. My experience in the past are mainly enterprise application development, usually use ORM layer (like typeorm) to mask the difference between databases and environments. I am looking for a library (or ready to contribute to built one) for mobile and PWA, which can hide the complexity underneth and provide consistant API for development. |
As I saw that you mentioned the typeorm (I found it very interesting), if you go to a project where sql is needed, I use in my projects ionic-database-builder, which in its base uses database-builder, currently I haven’t published the configuration for use with capacitor (open an issue there, which I add, because the provider isn’t complete yet), the purpose of not being an orm in fact, is just a way of abstracting much of the complexity of the sql commands, and not having to create string commands, which leads to many errors. |
Please reopen this issue. My company has been using enterprise-grade hybrid + web + pouchDB + cordova-sqlite-storage for many years now. I've been looking at ways to transition us off Cordova, but this is a major blocking problem.
To answer this, it's purely to act as a safe, permanent storage, nothing more fancy than that. I would not trust indexedDB on iOS device at all, it's primarily to ensure data permanence and no tricks being done by the WKWebKit module. We have high value clients and need to use the safest ways of data storage we can. Here's the implementation of it, you may want to model off that. |
Another big reason I forgot is that sqlite allows limits for indexeddb to be cancelled out, the way we use pouchDB means that often we may breach 100s of megabytes, even up to a 1GB of storage. Using this as an adapter will allow us to make the step fully out of Cordova space. Why not use SQL instead? We have a lot of 'templates' that consist of JSON documents with many flags and other things on them. Using the PouchDB map/reduce method, I can easily define a view that can interrogate each document in a bucket to give me specific results. It's a far more efficient and cleaner code than just iterating over an SQL table, and the performance profile is simple to understand. |
I should have added another couple of reasons:
I'm also asking the |
@jpike88 are you talking about a web app or native app? In Native the plugin stores the databases in the device as pure sqlite db. In web i use sql.js which use the database in memory and store it with localeforage in indexdb. There is also a method to store it in the filesystem if you wish. It working offline. If you want to connect it to a remote server there are mthods to import from and export to json object. I will not go for pouchdb. If you want to have this you must developp a pouchDb capacitor plugin on its own. Hope this clarify |
Fair enough... a shame because I can't just dump pouchdb anyway. I need to look at bringing that other plugin across. Do you know how hard that might be? |
Any plans for PouchDB wrapper?
Do you think it might help data avilabilty in browsers and PWA use cases?
The text was updated successfully, but these errors were encountered: