Ask how a studio PC is normally powered off and the honest answer is often "at the wall". Somebody trips a switch, the UPS runs out, the building loses power mid-song.
Any application storing data on such a machine has to assume the process can vanish between two writes.
What WAL changes
The play history database runs SQLite in write-ahead logging mode with synchronous=NORMAL.
In WAL mode, changes are appended to a separate log rather than rewritten into the main database file. A process that dies mid-transaction leaves an incomplete log entry, not a half-written database page. On next open, SQLite replays what was complete and discards what was not.
WAL also lets reads proceed while a write is in progress, which matters here because history writes happen during playback while the history window may be open.
What is in there
More than the name suggests. Alongside play history sit rotation clocks, rotation slots, repeat rule sets, audio categories, library track categories and AI usage logs.
Losing that file does not just cost you statistics — it costs your entire format configuration. Which is the argument for backing it up, and for caring about journaling mode.
Schema handled once
Schema DDL runs once per process rather than on every connection. A small optimisation with a real effect on startup time as the database grows.
Playlists are separate, and debounced
The current playlist is JSON, not database rows, and is saved on a three-second debounce after the last change. A burst of reordering produces one write. Duplicate states are skipped by comparing a content fingerprint, so a change that ends up back where it started writes nothing.
Writes run on a background thread, and are flushed synchronously on exit and before any discard or replace.
That flush is the part that makes debouncing safe. Deferring writes is only acceptable if you can guarantee the last one lands.
Backing up
Copy the local application data folder. It holds the database, the playlist, jingles, clock wheel slots and the loudness cache. On a machine that runs unattended, a weekly copy to another drive is the cheapest insurance available.