File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ npx cap sync
4242
4343## Usage
4444
45- ``` typescript
45+ ``` javascript
4646import { PowerSyncDatabase } from ' @powersync/capacitor' ;
4747// Import general components from the Web SDK package
4848import { Schema } from ' @powersync/web' ;
@@ -51,13 +51,26 @@ import { Schema } from '@powersync/web';
5151 * and use the appropriate database drivers.
5252 */
5353const db = new PowerSyncDatabase ({
54- schema: new Schema ({... })
54+ schema: new Schema ({... }),
55+ database: {
56+ dbFilename: " mydatabase.sqlite"
57+ }
5558});
5659```
5760
5861- On Android and iOS, this SDK uses [ Capacitor Community SQLite] ( https://github.com/capacitor-community/sqlite ) for native database access.
5962- On web, it falls back to the [ PowerSync Web SDK] ( https://www.npmjs.com/package/@powersync/web ) .
6063
64+ When using custom database factories, be sure to specify the ` CapacitorSQLiteOpenFactory ` for Capacitor platforms.
65+
66+ ``` javascript
67+ const db = new PowerSyncDatabase ({
68+ schema: new Schema ({... }),
69+ database: isWeb ? new WASQLiteOpenFactory ({dbFilename: " mydb.sqlite" }) :
70+ new CapacitorSQLiteOpenFactory ({dbFilename: " mydb.sqlite" })
71+ });
72+ ```
73+
6174## Platform Support
6275
6376- ** Android** : Uses native SQLite via Capacitor Community SQLite.
You can’t perform that action at this time.
0 commit comments