mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-04 13:29:32 +00:00
Add migrations for wrong negative line number in the review code comment
This commit is contained in:
parent
5ba2216a8c
commit
aaa53641ae
@ -24,6 +24,7 @@ import (
|
||||
"code.gitea.io/gitea/models/migrations/v1_22"
|
||||
"code.gitea.io/gitea/models/migrations/v1_23"
|
||||
"code.gitea.io/gitea/models/migrations/v1_24"
|
||||
"code.gitea.io/gitea/models/migrations/v1_25"
|
||||
"code.gitea.io/gitea/models/migrations/v1_6"
|
||||
"code.gitea.io/gitea/models/migrations/v1_7"
|
||||
"code.gitea.io/gitea/models/migrations/v1_8"
|
||||
@ -382,6 +383,9 @@ func prepareMigrationTasks() []*migration {
|
||||
newMigration(318, "Add anonymous_access_mode for repo_unit", v1_24.AddRepoUnitAnonymousAccessMode),
|
||||
newMigration(319, "Add ExclusiveOrder to Label table", v1_24.AddExclusiveOrderColumnToLabelTable),
|
||||
newMigration(320, "Migrate two_factor_policy to login_source table", v1_24.MigrateSkipTwoFactor),
|
||||
|
||||
// Gitea 1.24.0 ends at database version 321
|
||||
newMigration(321, "Migrate commit id of pull requests code review comment", v1_25.MigrateCommitIDOfPullRequestCodeReviewComment),
|
||||
}
|
||||
return preparedMigrations
|
||||
}
|
||||
|
14
models/migrations/v1_25/v321.go
Normal file
14
models/migrations/v1_25/v321.go
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright 2025 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package v1_25
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
// MigrateCommitIDOfPullRequestCodeReviewComment this will be almost right before comment on the special commit of the pull request
|
||||
func MigrateCommitIDOfPullRequestCodeReviewComment(x *xorm.Engine) error {
|
||||
_, err := x.Exec("UPDATE comment SET commit_sha = (select merge_base from pull_request WHERE issue_id = comment.issue_id) WHERE line < 0")
|
||||
return err
|
||||
}
|
Loading…
Reference in New Issue
Block a user