Skip to content

Persistence

Copy page
import { waSqlitePersistence, opSqlitePersistence, migrateClientStore } from "@nizhal/db-collection";
ExportPlatform
waSqlitePersistenceWeb — wa-sqlite + OPFS
opSqlitePersistenceReact Native — op-sqlite
migrateClientStoreApply NIZHAL_CLIENT_STORE_MIGRATIONS
createSerializedWaSqliteDatabaseHeadless/test SQLite via wa-sqlite WASM

Pass into nizhalCollectionOptions({ persistence }).

NIZHAL_CLIENT_STORE_VERSION and mergeClientStoreMigrations version the local schema. Call migrateClientStore on app upgrade before opening collections.

op-sqlite is RN-native and does not run in Node. Chaos tests use wa-sqlite WASM or node:sqlite with the same persistence code paths — behavioral fidelity without the native binary.

Verified on device: apps/op-sqlite-probe — offline write + restart survives via op-sqlite.