mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-19 12:20:53 +00:00
Merge master into indexbyfileext
This commit is contained in:
commit
021014acfe
|
@ -238,6 +238,8 @@ var migrations = []Migration{
|
||||||
NewMigration("change length of some repository columns", changeSomeColumnsLengthOfRepo),
|
NewMigration("change length of some repository columns", changeSomeColumnsLengthOfRepo),
|
||||||
// v91 -> v92
|
// v91 -> v92
|
||||||
NewMigration("add index on owner_id of repository and type, review_id of comment", addIndexOnRepositoryAndComment),
|
NewMigration("add index on owner_id of repository and type, review_id of comment", addIndexOnRepositoryAndComment),
|
||||||
|
// v92 -> v93
|
||||||
|
NewMigration("remove orphaned repository index statuses", removeLingeringIndexStatus),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrate database to current version
|
// Migrate database to current version
|
||||||
|
|
16
models/migrations/v92.go
Normal file
16
models/migrations/v92.go
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a MIT-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package migrations
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/go-xorm/xorm"
|
||||||
|
"xorm.io/builder"
|
||||||
|
)
|
||||||
|
|
||||||
|
func removeLingeringIndexStatus(x *xorm.Engine) error {
|
||||||
|
|
||||||
|
_, err := x.Exec(builder.Delete(builder.NotIn("`repo_id`", builder.Select("`id`").From("`repository`"))).From("`repo_indexer_status`"))
|
||||||
|
return err
|
||||||
|
}
|
|
@ -685,12 +685,14 @@ func rewriteAllPublicKeys(e Engine) error {
|
||||||
}
|
}
|
||||||
_, err = t.WriteString(line + "\n")
|
_, err = t.WriteString(line + "\n")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
f.Close()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
defer f.Close()
|
f.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t.Close()
|
||||||
return os.Rename(tmpPath, fPath)
|
return os.Rename(tmpPath, fPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,8 +120,8 @@ func getSlackDeletePayload(p *api.DeletePayload, slack *SlackMeta) (*SlackPayloa
|
||||||
|
|
||||||
// getSlackForkPayload composes Slack payload for forked by a repository.
|
// getSlackForkPayload composes Slack payload for forked by a repository.
|
||||||
func getSlackForkPayload(p *api.ForkPayload, slack *SlackMeta) (*SlackPayload, error) {
|
func getSlackForkPayload(p *api.ForkPayload, slack *SlackMeta) (*SlackPayload, error) {
|
||||||
baseLink := SlackLinkFormatter(p.Repo.HTMLURL, p.Repo.Name)
|
baseLink := SlackLinkFormatter(p.Forkee.HTMLURL, p.Forkee.FullName)
|
||||||
forkLink := SlackLinkFormatter(p.Forkee.HTMLURL, p.Forkee.FullName)
|
forkLink := SlackLinkFormatter(p.Repo.HTMLURL, p.Repo.FullName)
|
||||||
text := fmt.Sprintf("%s is forked to %s", baseLink, forkLink)
|
text := fmt.Sprintf("%s is forked to %s", baseLink, forkLink)
|
||||||
return &SlackPayload{
|
return &SlackPayload{
|
||||||
Channel: slack.Channel,
|
Channel: slack.Channel,
|
||||||
|
|
Loading…
Reference in a new issue