Skip to content

Commit

Permalink
Document import/export notes for WAL databases
Browse files Browse the repository at this point in the history
  • Loading branch information
simolus3 committed Jan 28, 2024
1 parent 1a1f53f commit 3e894f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/pages/docs/Examples/existing_databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ class MyDatabase extends _$MyDatabase {
// ...
```

### Additional considerations for WAL

When enabling [write-ahead logging](https://www.sqlite.org/wal.html), sqlite3 won't immediately
store all writes in the main database file. Instead, additional `-wal` and `-shm` files are
created to append new writes that are then periodically synced into the main database file.

Restoring a WAL database requires copying the `-wal` file as well.
When overwriting an existing WAL database on the device with a database using a different
journaling mode, the `-wal` file should be deleted too.

## Exporting a database

To export a sqlite3 database into a file, you can use the `VACUUM INTO` statement.
Expand Down
2 changes: 2 additions & 0 deletions docs/pages/docs/Platforms/vm.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ LazyDatabase(() async {
});
```

Using existing databases is explained in more detail in [this example]({{ '../Examples/existing_databases.md' | pageUrl }}).

## Used compile options on Android

On Android, iOS and macOs, depending on `sqlite3_flutter_libs` will include a custom build of sqlite instead of
Expand Down

0 comments on commit 3e894f9

Please sign in to comment.