Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqflite: enable WAL on Android #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions lib/sqf_executor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@ abstract class Executor<T extends TestEntity> extends ExecutorBase<T> {
: super(tracker);

static Future<Database> createDatabase(
Directory dbDir, String table, bool withIndexes) {
return openDatabase(dbDir.path, version: 1,
onCreate: (Database db, int version) async {
Directory dbDir, String table, bool withIndexes) async {
// Debug logging
// https://github.com/tekartik/sqflite/blob/master/sqflite/doc/dev_tips.md#debugging
// await databaseFactory.debugSetLogLevel(sqfliteLogLevelVerbose);

return openDatabase(dbDir.path, version: 1, onConfigure: (db) async {
// Make sure WAL is enabled on Android
// With debug logs on, should print "PRAGMA journal_mode=WAL"
// https://github.com/tekartik/sqflite/blob/master/sqflite/doc/dev_tips.md#enable-wal-on-android
await db.rawQuery('PRAGMA journal_mode=WAL');
}, onCreate: (Database db, int version) async {
await db.execute('''
CREATE TABLE $table (
id integer primary key autoincrement,
Expand Down