Merge branch 'soru/wal' into 'master'
Better format switching to WAL mode See merge request famedly/famedlysdk!349
This commit is contained in:
commit
b8c6decafc
|
@ -4,7 +4,6 @@ import 'dart:convert';
|
|||
import 'package:famedlysdk/famedlysdk.dart' as sdk;
|
||||
import 'package:famedlysdk/matrix_api.dart' as api;
|
||||
import 'package:olm/olm.dart' as olm;
|
||||
import 'package:pedantic/pedantic.dart';
|
||||
|
||||
import '../../matrix_api.dart';
|
||||
|
||||
|
@ -21,20 +20,6 @@ class Database extends _$Database {
|
|||
|
||||
int get maxFileSize => 1 * 1024 * 1024;
|
||||
|
||||
@override
|
||||
Future<void> beforeOpen(
|
||||
QueryExecutor executor, OpeningDetails details) async {
|
||||
await super.beforeOpen(executor, details);
|
||||
if (executor.dialect == SqlDialect.sqlite) {
|
||||
unawaited(customSelect('PRAGMA journal_mode=WAL').get().then((ret) {
|
||||
if (ret.isNotEmpty) {
|
||||
print('[Moor] Switched database to mode ' +
|
||||
ret.first.data['journal_mode'].toString());
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
MigrationStrategy get migration => MigrationStrategy(
|
||||
onCreate: (Migrator m) {
|
||||
|
@ -61,6 +46,15 @@ class Database extends _$Database {
|
|||
await m.createTable(outboundGroupSessions);
|
||||
}
|
||||
},
|
||||
beforeOpen: (_) async {
|
||||
if (executor.dialect == SqlDialect.sqlite) {
|
||||
final ret = await customSelect('PRAGMA journal_mode=WAL').get();
|
||||
if (ret.isNotEmpty) {
|
||||
print('[Moor] Switched database to mode ' +
|
||||
ret.first.data['journal_mode'].toString());
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
Future<DbClient> getClient(String name) async {
|
||||
|
|
Loading…
Reference in a new issue