From 596233002a2b1219f9b304f139abdf34632128cb Mon Sep 17 00:00:00 2001 From: Andrew Davis <1709934+Savid@users.noreply.github.com> Date: Wed, 10 Jun 2026 17:48:06 +1000 Subject: [PATCH] fix(db): connect to postgres via gorm's bundled pgx driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The skeleton refactor dropped the lib/pq blank import (old main.go) that registered the "postgres" database/sql driver, but the indexer still set postgres.Config.DriverName — which makes gorm call sql.Open("postgres", ...) and crash at startup with `sql: unknown driver "postgres"`. Leave DriverName empty so the gorm postgres dialect opens the connection through its bundled pgx driver. Verified against a real postgres 16 container: indexer boots, both frame_metadata tables auto-migrate, maintenance queries run. Co-Authored-By: Claude Fable 5 --- internal/db/indexer.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/db/indexer.go b/internal/db/indexer.go index b451bb1..d5a8a79 100644 --- a/internal/db/indexer.go +++ b/internal/db/indexer.go @@ -32,9 +32,13 @@ func NewIndexer(namespace string, log logrus.FieldLogger, config IndexerConfig, switch config.DriverName { case "postgres": + // Leave Config.DriverName empty so the gorm dialect connects via its + // bundled pgx driver; naming a driver makes gorm call + // sql.Open("postgres", ...), which requires a separately registered + // database/sql driver (the old lib/pq blank import this repo no + // longer has). conf := postgres.Config{ - DSN: config.DSN, - DriverName: "postgres", + DSN: config.DSN, } dialect := postgres.New(conf)