From b877e81c1d14505054077cc8709080e28dfe93f6 Mon Sep 17 00:00:00 2001 From: Krille Fear Date: Thu, 18 Nov 2021 10:46:08 +0100 Subject: [PATCH] feat: Configure database --- .../fluffybox_database.dart | 12 ++++++++++-- pubspec.lock | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/utils/matrix_sdk_extensions.dart/fluffybox_database.dart b/lib/utils/matrix_sdk_extensions.dart/fluffybox_database.dart index 65366f44f..611060aa4 100644 --- a/lib/utils/matrix_sdk_extensions.dart/fluffybox_database.dart +++ b/lib/utils/matrix_sdk_extensions.dart/fluffybox_database.dart @@ -65,8 +65,16 @@ class FlutterFluffyBoxDatabase extends FluffyBoxDatabase { final path = await _findDatabasePath(client); try { if (Platform.isAndroid || Platform.isIOS) { - //opensqflite.open.overrideFor(sqlite3.OperatingSystem.android, openCipherOnAndroid); - final db = await sqflite.openDatabase(path, password: password); + final db = await sqflite.openDatabase( + path, + password: password, + onConfigure: (db) async { + await db.execute('PRAGMA page_size = 8192'); + await db.execute('PRAGMA cache_size = 16384'); + await db.execute('PRAGMA temp_store = MEMORY'); + await db.rawQuery('PRAGMA journal_mode = WAL'); + }, + ); return db; } final db = await ffi.databaseFactoryFfi.openDatabase(path); diff --git a/pubspec.lock b/pubspec.lock index a8bfd06ff..677b6c1ef 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -357,7 +357,7 @@ packages: name: fluffybox url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.1.5" flutter: dependency: "direct main" description: flutter