Sync Server: add option to disable locking_mode exclusive

The self-hosted sync server opens the SQLite databases with locking_mode = EXCLUSIVE. This prevents other processes from reading the database while the sync server is running, for which I have two use cases:

  1. I want to automatically back up the collection.anki2 database for my user every night by executing .dump via sqlite3.
  2. I’d love to write a Prometheus exporter for the databases to get some dashboards in Grafana.

So it would be great if the locking_mode = EXCLUSIVE could be disabled with an environment variable (e.g. SYNC_LOCKING_MODE_NORMAL). If this sounds reasonable, I’d be happy to send a PR for this :slight_smile:

Relevant links (in a code block because this forum didn’t let me post them otherwise):

https://www.sqlite.org/pragma.html#pragma_locking_mode
https://github.com/ankitects/anki/blob/25.09.2/rslib/src/storage/sqlite.rs#L65