-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Is there any way to overwrite local database on sembast web? #290
Comments
sembast(io), sembast_web, sembast_sqflite uses different backend:
There is no such thing as a file on the web and the format on each platform is obviously different.
A database on the web is an IndexedDB database.
I'm afraid that is the only way though, sorry. It is a one line action to export/import a database and in general application should not rely of the backend implementation.
I guess by snapshot file you mean a file on the file system managed by Out of curiosity, how did you manage to get your custom snapshot file accessible on the web? If you managed, you could do the same by json encoding the exported map. |
@alextekartik Thanks for your quick response.
I sync data on desktop, then I copy the file as snapshot and put it into flutter assets, then I replace snapshot for all platforms. I choose that way because my database is quite large so it isn't good to load the whole json file. As you said, import/export is the only choice, so I have some questions:
|
import creates the database, so the database is clear before
You need the whole json in memory
sembast won't work for 1 million records. I suggest switching to another database for such requirements (SQLite). --alex |
I have the setup database like this:
On mobile I know exactly the database file path, then I can overwrite it with my custom snapshot file (I know there is a way to import/export data, but it isn't suitable for my requirements), like this:
But on web, I don't know how to do the same because there is no the file path.
I wonder where does the database locate on web?
The text was updated successfully, but these errors were encountered: