internal: update job_id column to be nullable - Column additions to existing tables are required to be nullable. Change-Id: Ide8a2459ab05d007725247f9566e4406e8b70cfe Reviewed-on: https://go-review.googlesource.com/c/pkgsite-metrics/+/702115 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ethan Lee <ethanalee@google.com> Reviewed-by: Markus Kusano <kusano@google.com>
diff --git a/internal/analysis/analysis.go b/internal/analysis/analysis.go index 0311804..b2f0616 100644 --- a/internal/analysis/analysis.go +++ b/internal/analysis/analysis.go
@@ -145,12 +145,12 @@ // Result is a row in the BigQuery analysis table. It corresponds to a // result from the output for an analysis. type Result struct { - CreatedAt time.Time `bigquery:"created_at"` - ModulePath string `bigquery:"module_path"` - Version string `bigquery:"version"` - SortVersion string `bigquery:"sort_version"` - CommitTime time.Time `bigquery:"commit_time"` - JobID string `bigquery:"job_id"` + CreatedAt time.Time `bigquery:"created_at"` + ModulePath string `bigquery:"module_path"` + Version string `bigquery:"version"` + SortVersion string `bigquery:"sort_version"` + CommitTime time.Time `bigquery:"commit_time"` + JobID bq.NullString `bigquery:"job_id"` // The name of the analysis binary that was executed. // A single binary may run multiple analyzers. BinaryName string `bigquery:"binary_name"`
diff --git a/internal/worker/analysis.go b/internal/worker/analysis.go index 0b06d91..d115f5f 100644 --- a/internal/worker/analysis.go +++ b/internal/worker/analysis.go
@@ -187,7 +187,7 @@ func (s *analysisServer) scan(ctx context.Context, req *analysis.ScanRequest, localBinaryPath string, wv analysis.WorkVersion) *analysis.Result { row := &analysis.Result{ ModulePath: req.Module, - JobID: req.JobID, + JobID: bq.NullString{StringVal: req.JobID, Valid: req.JobID != ""}, Version: req.Version, BinaryName: req.Binary, WorkVersion: wv,
diff --git a/internal/worker/analysis_test.go b/internal/worker/analysis_test.go index 6182e90..f43b5bb 100644 --- a/internal/worker/analysis_test.go +++ b/internal/worker/analysis_test.go
@@ -158,7 +158,7 @@ Version: version, SortVersion: "0,0,0,~20250813163312-416cbb1e76e6", CommitTime: commitTime, - JobID: "jid", + JobID: bq.NullString{StringVal: "jid", Valid: true}, BinaryName: "analyzer", WorkVersion: wv, Error: "", @@ -194,7 +194,7 @@ ModulePath: modulePath, Version: version, SortVersion: "0,0,0,~20250813163312-416cbb1e76e6", - JobID: "jid", + JobID: bq.NullString{StringVal: "jid", Valid: true}, BinaryName: "bad", WorkVersion: wv, ErrorCategory: "SYNTHETIC - MISC",