Add support for Postgres database #10
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add config toggle to enable writing to Postgres database - useful in deployments from #9 as MDAD provides a managed postgres database already
Need to:
After digging into the storage architecture for this, a heads-up that this is more involved than the issue assumes — and likely not the right tool for this bridge.
This bridge has no SQL of its own. Unlike mautrix bridges (which own a schema and support sqlite/postgres), nether-voicebridge has zero SQL queries, zero
sqlx/rusqlite/postgresdependencies, and no tables. All persistence is matrix-sdk's stores (crypto + state + event-cache), which use SQLite internally via thebundled-sqlitefeature. So there's nothing of "ours" to make Postgres-compatible — the first task in this issue ("confirm all SQL queries are compatible") doesn't apply.Supporting Postgres would mean writing a custom Postgres backend for matrix-sdk's stores (implementing its
StateStore+CryptoStore+EventCacheStoretraits). matrix-sdk 0.18 doesn't ship one (only SQLite + IndexedDB-for-wasm), so we'd own and maintain it ourselves. TheCryptoStorehalf is E2EE-correctness-critical — getting it subtly wrong breaks encrypted audio. Realistically this is weeks of work plus a permanent maintenance/risk burden, not a config toggle.The practical path for MDAD / managed deploys: this bridge isn't a homeserver — its stores are small, embedded, per-process SQLite files. What it needs for statefulness is a persistent volume for
NVB_DATA_DIR, which the Docker image already supports (VOLUME ["/app/data"], store paths auto-derive under it). Postgres is the right choice for Synapse-class services; for a voice participant bridge with tiny local stores, a mounted volume is the correct and far simpler answer. If a deployment genuinely can only offer Postgres and not a volume, the real fix is upstream matrix-sdk gaining a Postgres store — not us reimplementing it.Recommendation: keep SQLite + a persistent volume; revisit only if matrix-sdk adds first-class Postgres support.