internal/postgres: insert units.v1path_id

Change-Id: I464e1cb9b25e35fefa03df052db96ddda70026a1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/281777
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/internal/postgres/insert_module.go b/internal/postgres/insert_module.go
index a69d6c3..03c9b55 100644
--- a/internal/postgres/insert_module.go
+++ b/internal/postgres/insert_module.go
@@ -304,11 +304,13 @@
 				}
 			}
 		}
+		v1path := internal.V1Path(u.Path, m.ModulePath)
 		unitValues = append(unitValues,
 			u.Path,
 			pathToID[u.Path],
 			moduleID,
-			internal.V1Path(u.Path, m.ModulePath),
+			pathToID[v1path],
+			v1path,
 			u.Name,
 			pq.Array(licenseTypes),
 			pq.Array(licensePaths),
@@ -399,6 +401,7 @@
 		"path",
 		"path_id",
 		"module_id",
+		"v1path_id",
 		"v1_path",
 		"name",
 		"license_types",