internal/postgres: insert new latest_module_versions columns

For golang/go#43265

Change-Id: I545d43984676fdef34d942de8e3bcaaf88aa679b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/307473
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
diff --git a/internal/latest.go b/internal/latest.go
index 6033b43..14ccf16 100644
--- a/internal/latest.go
+++ b/internal/latest.go
@@ -21,7 +21,7 @@
 	CookedVersion      string        // considering retractions
 	GoodVersion        string        // successfully processed
 	GoModFile          *modfile.File // of raw
-	deprecated         bool
+	Deprecated         bool
 	deprecationComment string
 }
 
@@ -38,7 +38,7 @@
 		CookedVersion:      cooked,
 		GoodVersion:        good,
 		GoModFile:          modFile,
-		deprecated:         dep,
+		Deprecated:         dep,
 		deprecationComment: comment,
 	}, nil
 }
@@ -64,7 +64,7 @@
 
 // PopulateModuleInfo uses the LatestModuleVersions to populate fields of the given module.
 func (li *LatestModuleVersions) PopulateModuleInfo(mi *ModuleInfo) {
-	mi.Deprecated = li.deprecated
+	mi.Deprecated = li.Deprecated
 	mi.DeprecationComment = li.deprecationComment
 	mi.Retracted, mi.RetractionRationale = isRetracted(li.GoModFile, mi.Version)
 }
diff --git a/internal/postgres/version.go b/internal/postgres/version.go
index ff00e70..3e987dc 100644
--- a/internal/postgres/version.go
+++ b/internal/postgres/version.go
@@ -513,11 +513,13 @@
 	var (
 		raw, cooked, good string
 		goModBytes        = []byte{} // not nil, a zero-length slice
+		deprecated        bool
 	)
 	if lmv != nil {
 		raw = lmv.RawVersion
 		cooked = lmv.CookedVersion
 		good = lmv.GoodVersion
+		deprecated = lmv.Deprecated
 		// Convert the go.mod file into bytes.
 		goModBytes, err = lmv.GoModFile.Format()
 		if err != nil {
@@ -527,21 +529,25 @@
 	_, err = tx.Exec(ctx, `
 		INSERT INTO latest_module_versions (
 			module_path_id,
+			series_path,
 			raw_version,
 			cooked_version,
 			good_version,
+			deprecated,
 			raw_go_mod_bytes,
 			status
-		) VALUES ($1, $2, $3, $4, $5, $6)
+		) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
 		ON CONFLICT (module_path_id)
 		DO UPDATE SET
+			series_path=excluded.series_path,
 			raw_version=excluded.raw_version,
 			cooked_version=excluded.cooked_version,
 			good_version=excluded.good_version,
+			deprecated=excluded.deprecated,
 			raw_go_mod_bytes=excluded.raw_go_mod_bytes,
 			status=excluded.status
 		`,
-		id, raw, cooked, good, goModBytes, status)
+		id, internal.SeriesPathForModule(modulePath), raw, cooked, good, deprecated, goModBytes, status)
 	return err
 }