Skip to main content

Moving from @capacitor-community/sqlite

Most apps using this plugin should keep it. It gives you SQL, joins, SQLCipher and an Electron target, and Strata's sqlite adapter gives you none of those: you can't write SQL against it. This guide is for the case where your database turned out to be one key-value table.

The calls​

@capacitor-community/sqliteStrata Storage
db.run('INSERT OR REPLACE ...', [key, value])storage.set(key, value, { storage: 'sqlite' })
db.query('SELECT value ... WHERE key = ?', [key])storage.get(key, { storage: 'sqlite' })
db.run('DELETE ... WHERE key = ?', [key])storage.remove(key, { storage: 'sqlite' })
db.query('SELECT key ...')storage.keys(undefined, { storage: 'sqlite' })
db.query('SELECT ... WHERE field = ?')storage.query({ field }, { storage: 'sqlite' }), a scan of every value

Copy the table​

This assumes a table named kv with key and value text columns holding JSON. Change the SQL to match yours.

import { CapacitorSQLite, SQLiteConnection } from '@capacitor-community/sqlite';
import { defineStorage } from 'strata-storage';
import { registerCapacitorAdapters } from 'strata-storage/capacitor';

export const storage = defineStorage();

export async function moveKeyValueTable(): Promise<void> {
await registerCapacitorAdapters(storage);
if (await storage.get<boolean>('moved:sqlite', { storage: 'sqlite' })) return;
const sqlite = new SQLiteConnection(CapacitorSQLite);
const db = await sqlite.createConnection('app', false, 'no-encryption', 1, false);
await db.open();
const { values = [] } = await db.query('SELECT key, value FROM kv');
for (const row of values as { key: string; value: string }[]) {
await storage.set(row.key, JSON.parse(row.value), { storage: 'sqlite' });
}
await sqlite.closeConnection('app', false);
await storage.set('moved:sqlite', true, { storage: 'sqlite' });
}

Strata writes to its own database, strata_storage unless you configure another, so the old file stays untouched until you delete it. If the old database is encrypted with SQLCipher, open it with the matching mode and passphrase, and decide how the values are protected on the other side first: Strata's encryption isn't SQLCipher. See the sqlite adapter for what it stores.

Read a moved key on each device before you remove the plugin.

@capacitor-community/sqlite as we checked it​

Last checked 7 Nov 2026. "Not stated" means the pages we checked don't mention it, not that the library can't do it. Check @capacitor-community/sqlite yourself, or see the side-by-side page.

Store or capability@capacitor-community/sqliteStrata Storage
localStorageNot stated on the pages we checkedYes
IndexedDBNot stated on the pages we checkedYes
sessionStorageNot stated on the pages we checkedYes
CookiesNot stated on the pages we checkedYes
URL parameters as a storeNot stated on the pages we checkedYes
iOS KeychainNot stated on the pages we checked. The README configures an iosKeychainPrefix for the database passphrase, not a key-value Keychain storeYes
Android secure storage (Keystore-backed)Not stated on the pages we checkedYes
Native preferences (UserDefaults / SharedPreferences)Not stated on the pages we checkedYes
Web and native stores behind one APINot stated on the pages we checkedYes
No runtime dependenciesNo. Depends on jeep-sqlite (source, 7 Nov 2026)Yes
Package fact@capacitor-community/sqliteStrata Storage
LicenceMIT (source)MIT (source)
npm version8.1.13.1.4
Bundle size2,680 bytes gzipped, 13,852 minified, version 8.1.1, 7 Nov 2026. JavaScript side only; the native code is not counted by bundlephobia (source)21,468 bytes gzipped, 79,645 minified, version 3.1.4, 7 Nov 2026 (source)
Weekly downloads249,947, 31 Oct 2026 to 6 Nov 2026 (source)486, 31 Oct 2026 to 6 Nov 2026 (source)