mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-12 07:09:36 +08:00
Backport #27205 by @KN4CK3R
Fixes #27174
`release` is a reserved keyword in MySql. I can't reproduce the issue on
my setup and we have a test for that code but it seems there can be
setups where it fails.
a101dbaa79/tests/integration/repo_activity_test.go (L45-L46)
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
This commit is contained in:
parent
2181b3713e
commit
64c0a6a4e2
@ -342,7 +342,7 @@ func (stats *ActivityStats) FillReleases(ctx context.Context, repoID int64, from
|
|||||||
|
|
||||||
// Published releases list
|
// Published releases list
|
||||||
sess := releasesForActivityStatement(ctx, repoID, fromTime)
|
sess := releasesForActivityStatement(ctx, repoID, fromTime)
|
||||||
sess.OrderBy("release.created_unix DESC")
|
sess.OrderBy("`release`.created_unix DESC")
|
||||||
stats.PublishedReleases = make([]*repo_model.Release, 0)
|
stats.PublishedReleases = make([]*repo_model.Release, 0)
|
||||||
if err = sess.Find(&stats.PublishedReleases); err != nil {
|
if err = sess.Find(&stats.PublishedReleases); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -350,7 +350,7 @@ func (stats *ActivityStats) FillReleases(ctx context.Context, repoID int64, from
|
|||||||
|
|
||||||
// Published releases authors
|
// Published releases authors
|
||||||
sess = releasesForActivityStatement(ctx, repoID, fromTime)
|
sess = releasesForActivityStatement(ctx, repoID, fromTime)
|
||||||
if _, err = sess.Select("count(distinct release.publisher_id) as `count`").Table("release").Get(&count); err != nil {
|
if _, err = sess.Select("count(distinct `release`.publisher_id) as `count`").Table("release").Get(&count); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
stats.PublishedReleaseAuthorCount = count
|
stats.PublishedReleaseAuthorCount = count
|
||||||
@ -359,7 +359,7 @@ func (stats *ActivityStats) FillReleases(ctx context.Context, repoID int64, from
|
|||||||
}
|
}
|
||||||
|
|
||||||
func releasesForActivityStatement(ctx context.Context, repoID int64, fromTime time.Time) *xorm.Session {
|
func releasesForActivityStatement(ctx context.Context, repoID int64, fromTime time.Time) *xorm.Session {
|
||||||
return db.GetEngine(ctx).Where("release.repo_id = ?", repoID).
|
return db.GetEngine(ctx).Where("`release`.repo_id = ?", repoID).
|
||||||
And("release.is_draft = ?", false).
|
And("`release`.is_draft = ?", false).
|
||||||
And("release.created_unix >= ?", fromTime.Unix())
|
And("`release`.created_unix >= ?", fromTime.Unix())
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ func checkDBConsistency(ctx context.Context, logger log.Logger, autofix bool) er
|
|||||||
},
|
},
|
||||||
// find releases without existing repository
|
// find releases without existing repository
|
||||||
genericOrphanCheck("Orphaned Releases without existing repository",
|
genericOrphanCheck("Orphaned Releases without existing repository",
|
||||||
"release", "repository", "release.repo_id=repository.id"),
|
"release", "repository", "`release`.repo_id=repository.id"),
|
||||||
// find pulls without existing issues
|
// find pulls without existing issues
|
||||||
genericOrphanCheck("Orphaned PullRequests without existing issue",
|
genericOrphanCheck("Orphaned PullRequests without existing issue",
|
||||||
"pull_request", "issue", "pull_request.issue_id=issue.id"),
|
"pull_request", "issue", "pull_request.issue_id=issue.id"),
|
||||||
|
Loading…
Reference in New Issue
Block a user