Skip to content

Commit 03c2b03

Browse files
committed
Use OPFS for diagnostics app.
1 parent 968402a commit 03c2b03

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

tools/diagnostics-app/src/library/powersync/ConnectionManager.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import {
44
PowerSyncDatabase,
55
WebRemote,
66
WebStreamingSyncImplementation,
7-
WebStreamingSyncImplementationOptions
7+
WebStreamingSyncImplementationOptions,
8+
WASQLiteOpenFactory,
9+
TemporaryStorageOption,
10+
WASQLiteVFS
811
} from '@powersync/web';
912
import Logger from 'js-logger';
1013
import { DynamicSchemaManager } from './DynamicSchemaManager';
@@ -25,12 +28,16 @@ export const getParams = () => {
2528

2629
export const schemaManager = new DynamicSchemaManager();
2730

31+
const openFactory = new WASQLiteOpenFactory({
32+
dbFilename: 'diagnostics.db',
33+
debugMode: true,
34+
cacheSizeKb: 500 * 1024,
35+
temporaryStorage: TemporaryStorageOption.MEMORY,
36+
vfs: WASQLiteVFS.OPFSCoopSyncVFS
37+
});
38+
2839
export const db = new PowerSyncDatabase({
29-
database: {
30-
dbFilename: 'example.db',
31-
debugMode: true,
32-
cacheSizeKb: 500000
33-
},
40+
database: openFactory,
3441
schema: schemaManager.buildSchema()
3542
});
3643

0 commit comments

Comments
 (0)