internal/postgres: remove uses of modules.deprecated_comment

The deprecated_column in the modules table has been superseded by the
information in the latest_module_versions table.

For golang/go#43265

Change-Id: Ib53e0b295a3edf8e807ff825b36baa6701b927b1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/309610
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
This commit is contained in:
Jonathan Amsterdam 2021-04-13 07:23:46 -04:00
Родитель 08612630e8
Коммит 58432cb4a0
3 изменённых файлов: 4 добавлений и 22 удалений

Просмотреть файл

@ -31,7 +31,6 @@ func (db *DB) GetNestedModules(ctx context.Context, modulePath string) (_ []*int
m.commit_time,
m.redistributable,
m.has_go_mod,
m.deprecated_comment,
m.source_info
FROM
modules m
@ -139,7 +138,6 @@ func (db *DB) GetModuleInfo(ctx context.Context, modulePath, resolvedVersion str
commit_time,
redistributable,
has_go_mod,
deprecated_comment,
source_info
FROM
modules
@ -193,18 +191,11 @@ func (s jsonbScanner) Scan(value interface{}) (err error) {
// scanModuleInfo constructs an *internal.ModuleInfo from the given scanner.
func scanModuleInfo(scan func(dest ...interface{}) error) (*internal.ModuleInfo, error) {
var (
mi internal.ModuleInfo
depComment *string
)
var mi internal.ModuleInfo
if err := scan(&mi.ModulePath, &mi.Version, &mi.CommitTime,
&mi.IsRedistributable, &mi.HasGoMod, &depComment, jsonbScanner{&mi.SourceInfo}); err != nil {
&mi.IsRedistributable, &mi.HasGoMod, jsonbScanner{&mi.SourceInfo}); err != nil {
return nil, err
}
if depComment != nil {
mi.Deprecated = true
mi.DeprecationComment = *depComment
}
return &mi, nil
}

Просмотреть файл

@ -222,13 +222,7 @@ func insertModule(ctx context.Context, db *database.DB, m *internal.Module) (_ i
if err != nil {
return 0, err
}
var (
moduleID int
depComment *string
)
if m.Deprecated {
depComment = &m.DeprecationComment
}
var moduleID int
err = db.QueryRow(ctx,
`INSERT INTO modules(
module_path,
@ -240,9 +234,8 @@ func insertModule(ctx context.Context, db *database.DB, m *internal.Module) (_ i
source_info,
redistributable,
has_go_mod,
deprecated_comment,
incompatible)
VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)
VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)
ON CONFLICT
(module_path, version)
DO UPDATE SET
@ -258,7 +251,6 @@ func insertModule(ctx context.Context, db *database.DB, m *internal.Module) (_ i
sourceInfoJSON,
m.IsRedistributable,
m.HasGoMod,
depComment,
version.IsIncompatible(m.Version),
).Scan(&moduleID)
if err != nil {

Просмотреть файл

@ -55,7 +55,6 @@ func getPathVersions(ctx context.Context, db *DB, path string, versionTypes ...v
m.commit_time,
m.redistributable,
m.has_go_mod,
m.deprecated_comment,
m.source_info
FROM modules m
INNER JOIN units u