feat: show admin UI warning for SQLite on networked filesystem (#1713)

Co-authored-by: Elias Schneider <login@eliasschneider.com>
This commit is contained in:
Alessandro (Ale) Segala
2026-08-24 15:03:31 -07:00
committed by GitHub
co-authored by Elias Schneider
parent d258d952b1
commit 29a6fd6c29
17 changed files with 278 additions and 91 deletions
@@ -27,6 +27,10 @@ import (
sqliteutil "github.com/pocket-id/pocket-id/backend/internal/utils/sqlite"
)
// Records whether the SQLite database was found on a networked filesystem
// It's always false when using Postgres
var sqliteOnNetworkedFilesystem bool
func NewDatabase(ctx context.Context) (db *gorm.DB, pg *pgxpool.Pool, err error) {
db, pg, err = ConnectDatabase(ctx)
if err != nil {
@@ -68,6 +72,9 @@ func ConnectDatabase(ctx context.Context) (db *gorm.DB, pg *pgxpool.Pool, err er
return nil, nil, err
}
// Detect whether the database lives on a networked filesystem to show a warning in the admin UI
sqliteOnNetworkedFilesystem = connector.IsNetworked()
// We open the connection ourselves, rather than letting Gorm do it, so it goes through the instrumented driver
// It also caps in-memory databases to a single connection, which they need to see the whole data
sqliteDB, err := sqliteinstrument.Open(connector, sqlInstrumentOptions())