kikko
kikko copied to clipboard
How to dump to sqlite file?
and import sqlite file
For which platform? Web, desktop, mobile?
I was also wondering how to do that for the web platform ! I figured it might already be possible using something like https://sql.js.org/#/?id=write-a-database-to-the-disk ? but idk if we can use that export
function with @kikko-land/sql.js
web platform。Thanks for your reply
@astahmer yeah, I think I will expose API for dumping and loading SQLite db
@quolpr
Can you expose api for reading and writing files?
I want to write files in indexeddb before initDbClient
@ununian I will add support once I finish this PR https://github.com/kikko-land/kikko/pull/61 , that adds massive changes to the code.
You will be able to call before initDbClient
, the API will look something like this:
const backend = absurdWebBackend({
wasmUrl: sqlWasmUrl,
});
const config: IInitDbClientConfig = {
dbName: "db-name",
dbBackend: backend,
plugins: [
migrationsPlugin({ migrations: [createNotesTableMigration] }),
reactiveQueriesPlugin(),
],
};
const data = backend.export() // exporting DB Uint8Array
backend.load(data) // loading DB