pragma update and WAL checkpoint feat

This commit is contained in:
shenlong-tanwen 2025-05-09 17:46:51 +05:30
parent 63ebba671b
commit 35c3f7211f
2 changed files with 14 additions and 5 deletions

View File

@ -58,8 +58,9 @@ class Drift extends $Drift implements IDatabaseRepository {
@override
MigrationStrategy get migration => MigrationStrategy(
beforeOpen: (details) async {
await customStatement('PRAGMA journal_mode = WAL');
await customStatement('PRAGMA foreign_keys = ON');
await customStatement('PRAGMA synchronous = NORMAL');
await customStatement('PRAGMA journal_mode = WAL');
},
);
}

View File

@ -4,18 +4,26 @@ import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/providers/background_sync.provider.dart';
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
final _features = [
_Features(
_Feature(
name: 'Sync Local',
icon: Icons.photo_album_rounded,
onTap: (ref) => ref.read(backgroundSyncProvider).syncLocal(),
),
_Features(
_Feature(
name: 'Sync Remote',
icon: Icons.refresh_rounded,
onTap: (ref) => ref.read(backgroundSyncProvider).syncRemote(),
),
_Feature(
name: 'WAL Checkpoint',
icon: Icons.save_rounded,
onTap: (ref) => ref
.read(driftProvider)
.customStatement("pragma wal_checkpoint(truncate)"),
),
];
@RoutePage()
@ -46,8 +54,8 @@ class FeatInDevPage extends StatelessWidget {
}
}
class _Features {
const _Features({
class _Feature {
const _Feature({
required this.name,
required this.icon,
required this.onTap,