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

Open
julieqiu opened this issue Jul 10, 2020 · 0 comments
Open

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

julieqiu opened this issue Jul 10, 2020 · 0 comments
Assignees
Milestone

Comments

@julieqiu
Copy link
Contributor

@julieqiu 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.

@gopherbot gopherbot added this to the Unreleased milestone 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.