mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 19:16:08 +00:00
fix(db): refuse a Postgres boot that would leave a SQLite install behind
Setting TREK_DB_URL on an existing SQLite install booted a new, empty instance beside its data. The Postgres bootstrap now refuses an empty database, or a migrated one without a single account, while the data directory's travel.db holds accounts, and names the move command. A file that cannot be read counts as holding them. TREK_DB_IGNORE_SQLITE_FILE=true starts anyway, with a warning; the file is opened read-only and only when the database holds no TREK data.
This commit is contained in:
@@ -57,6 +57,7 @@ DEMO_MODE=false # Demo mode: resets data hourly
|
||||
# TREK_DB_POOL_MAX=10 # Most connections TREK opens to the Postgres database (1 to 100). Unused on SQLite. (default: 10)
|
||||
# TREK_DB_JOURNAL_MODE=WAL # SQLite journal mode (DELETE, TRUNCATE, PERSIST, MEMORY, WAL, OFF). WAL is fastest and the right choice on local disk. Set DELETE if the data directory lives on network storage (Azure App Service, an SMB/NFS volume on a NAS) — WAL coordinates writers through a shared-memory file that those filesystems do not implement reliably. The mode is stored inside the database file, so it survives a restart; changing this applies on the next boot.
|
||||
# TREK_DB_PRE_MIGRATE_SNAPSHOT=true # Copy the database to data/pre-migrate-<schema>-<time>.db (a .pgdump made with pg_dump on Postgres) before a startup migrates it, so the previous image can run on the copy again. A copy that cannot be written stops the startup; false migrates without one.
|
||||
# TREK_DB_IGNORE_SQLITE_FILE=false # With TREK_DB_URL set, TREK refuses to start on a Postgres database that holds no TREK data while data/travel.db holds an existing SQLite install, because it would come up as a new, empty instance beside it. Move the install with the move-to-postgres command instead (wiki: Database-Postgres). true starts on the empty database anyway. Unused on SQLite. (default: false)
|
||||
# TREK_DB_PRE_MIGRATE_SNAPSHOT_KEEP=3 # How many pre-migrate copies to keep, newest first (1 to 100). (default: 3)
|
||||
# TREK_DB_SYNCHRONOUS=NORMAL # How hard SQLite flushes to disk (OFF, NORMAL, FULL, EXTRA). Defaults to NORMAL under WAL and FULL under any other journal mode — leave it alone unless you know why you want otherwise. Both variables fall back to their default (with a warning in the log) if the value is not a mode SQLite knows.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user