fix(db): reset the admin on Postgres and keep the key rotation off it

reset-admin.js opened data/travel.db with better-sqlite3 whatever the
engine, so on a Postgres install it created a stray SQLite file or reset
the admin in a leftover one. With TREK_DB_URL set it now resets the account
in Postgres through the built server's engine (its pool, SSL and write
lock, in one transaction), and refuses a TREK_DB_FILE beside the URL; the
SQLite branch is unchanged. migrate-encryption.ts cannot re-encrypt the
secrets in Postgres yet, so it now stops before it opens or writes any file
when TREK_DB_URL is set. The wiki says what each does on Postgres.
This commit is contained in:
Maurice
2026-11-17 12:16:12 +01:00
parent c3f6177be1
commit 693acd5580
7 changed files with 257 additions and 83 deletions
+2
View File
@@ -58,6 +58,8 @@ To find your current key: check the `ENCRYPTION_KEY` environment variable or rea
Use `scripts/migrate-encryption.ts` to re-encrypt the stored secrets listed below without downtime or manual re-entry.
The script works on the SQLite database only. On a [Postgres](Database-Postgres) install (`TREK_DB_URL` set) it stops before it changes anything, because it cannot re-encrypt the secrets held in Postgres yet. Keep the current key there; rotating a `travel.db` left over from before the move would rewrite the key file while the secrets in Postgres stay under the old key.
**Docker:**
```bash