Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/pkgsite: add a function to get the version history for a path #40150

Closed
julieqiu opened this issue Jul 10, 2020 · 1 comment
Closed

x/pkgsite: add a function to get the version history for a path #40150

julieqiu opened this issue Jul 10, 2020 · 1 comment
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite
Milestone

Comments

@julieqiu
Copy link
Member

julieqiu commented Jul 10, 2020

As part of the new data model migration (#39629), we will be deprecating these functions:

  • LegacyGetPsuedoVersionsForModule
  • LegacyGetPsuedoVersionsForPackageSeries
  • LegacyGetTaggedVersionsForModule
  • LegacyGetTaggedVersionsForPackageSeries

See http://github.com/golang/pkgsite/blob/master/internal/postgres/version.go.

We want fetch version history from the paths table instead.

The query to execute is:

SELECT
    p.path,
    p.module_path,
    p.version,
    p.commit_time
FROM modules m
INNER JOIN paths p
ON p.module_id = m.id
WHERE
    m.module_path = $1
    AND m.version = $2
    AND p.path = $3
ORDER BY
   CASE WHEN version_type = 'release' THEN 0
              WHEN version_type = 'prerelease' THEN 1
              ELSE 2
              END,
   m.sort_version DESC;

If we know about release or pre-release versions for path, return them all. Don't return an pseudoversions.

If we only know about pseudoversions, return the 10 most recent.

@julieqiu julieqiu added Suggested Issues that may be good for new contributors looking for work to do. help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite labels Jul 10, 2020
@gopherbot gopherbot added this to the Unreleased milestone Jul 10, 2020
@julieqiu julieqiu removed Suggested Issues that may be good for new contributors looking for work to do. help wanted labels Jul 10, 2020
@golang golang deleted a comment from gopherbot Jul 16, 2020
gopherbot pushed a commit to golang/pkgsite that referenced this issue Jul 23, 2020
Adds a db method to get version history for a given path. It will
return pre-release and release versions of a package if tagged
versions exist or the first 10 pseudo versions.

In supporting getting version history based on path, this method
will replace the following legacy methods:
- LegacyGetTaggedVersionsForPackageSeries
- LegacyGetPsuedoVersionsForPackageSeries
- LegacyGetTaggedVersionsForModule
- LegacyGetPsuedoVersionsForModule

For golang/go#39629
For golang/go#40150

Change-Id: I251e80e5327e422579fd8c0854f1e93d1865d48d
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242881
Reviewed-by: Julie Qiu <julie@golang.org>
@julieqiu
Copy link
Member Author

Implemented in https://golang.org/cl/242881.

@golang golang locked and limited conversation to collaborators Aug 18, 2021
@rsc rsc unassigned jamalc Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite
Projects
None yet
Development

No branches or pull requests

3 participants