diff --git a/cmd/ingestor/db.go b/cmd/ingestor/db.go index 449a286..3a86f1b 100644 --- a/cmd/ingestor/db.go +++ b/cmd/ingestor/db.go @@ -170,7 +170,7 @@ func applySchema(db *sql.DB) error { // Create/rebuild packets_v view (v3 schema: observer_idx → observers.rowid) // The Go server reads this view; without it fresh installs get "no such table: packets_v". db.Exec(`DROP VIEW IF EXISTS packets_v`) - _, err = db.Exec(` + _, vErr := db.Exec(` CREATE VIEW packets_v AS SELECT o.id, t.raw_hex, datetime(o.timestamp, 'unixepoch') AS timestamp, @@ -182,8 +182,8 @@ func applySchema(db *sql.DB) error { JOIN transmissions t ON t.id = o.transmission_id LEFT JOIN observers obs ON obs.rowid = o.observer_idx `) - if err != nil { - return fmt.Errorf("packets_v view: %w", err) + if vErr != nil { + return fmt.Errorf("packets_v view: %w", vErr) } // One-time migration: recalculate advert_count to count unique transmissions only