-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Convert IndexedDB to SQLite #690
Comments
Here are some lnks: SQLite Wasm wrapped in TypeScript These articles have instructions for downloading the SQLite Wasm and integrating it into a SvelteKit application. I think it would be better to import SQLite Wasm from an NPM module.
It looks we need to use Origin Private File System or OPFS for short. This enables writing to the SQLite database. You should take into account that there will be multiple apps published at the same origin and that we need to segment the data based on the package name in the configuration. It looks like these writes should happen in a Web Worker so we will need to learn how to use those as well. The Scripture PWA currently uses a Web Worker for search. |
Here is the code from the Android app (Java) to create the private static final String ANNOTATIONS_TABLE = "annotations";
private String getSqlForCreateAnnotationsTable() {
return "CREATE TABLE " + ANNOTATIONS_TABLE + " (" +
" id TEXT PRIMARY KEY, " + // unique ID
" date DATETIME, " + // date modified
" page TEXT, " + // page reference (book collection, book, chapter)
" type TEXT, " + // annotation type
" details TEXT, " + // details as JSON string
" deleted INT DEFAULT 0" + // deleted
");";
} |
I have started the work of including SQLite WASM into the dependencies: https://github.com/sillsdev/appbuilder-pwa/tree/feature/sqlite-wasm-dependency |
Create a empty database based on schema from the IndexedDB code. |
There are many features that have already been developed that are being shared between the SAB and DAB PWA. This is to do some work for the SAB app that is not shared with DAB, but needs to be done soon without anyone to work on it.
For storing annotations, the PWA used IndexedDB. It turns out that IndexedDB is not a stable place to store data long-term.
https://gist.github.com/pesterhazy/4de96193af89a6dd5ce682ce2adff49a
We need to convert the mechanism for storing data from IndexedDB to SQLite.
The text was updated successfully, but these errors were encountered: