Read-only mode
The database supports a read-only mode which can be used during upgrades or for failover/verification.
Read-only mode is separate from restore mode - restore mode generally disables tasks that have external effects or trigger modifications, but does not block updates to the database itself.
Read-only mode works at the HareScript level and is checked at work begin and commit. Direct connections to the database can still modify it.
To enter read-only mode: `wh db setserver readonly`
To exit read-only mode: `wh db setserver readwrite`
Effects of readonly mode
`GetPrimary()->BeginWork()` will throw immediately. You can check %IsDatabaseReadonly to help prevent this situation, but to handle this in a race-free manner you need to properly handle the %DatabaseReadonlyExceptionÂ
`ScreenBase::BeginWork` will work, but Finish will report that the database is in readonly mode and fail (Similar to deadlock/unique constraint violations that aren't caught until Finish)
Upgrading Posgresql
To upgrade the WebHare database on macOS from 12 to 13:
If all seems fine, you can delete $WHDATA/postgresql/db.bak at some point