mirror of
https://github.com/go-gitea/gitea.git
synced 2025-05-05 15:32:53 +00:00
Explicitly not update indexes when sync database schemas (#34281)
Fix #34275 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
27ff5e2e84
commit
44ece1e6f3
@ -14,5 +14,9 @@ func AddContentVersionToIssueAndComment(x *xorm.Engine) error {
|
|||||||
ContentVersion int `xorm:"NOT NULL DEFAULT 0"`
|
ContentVersion int `xorm:"NOT NULL DEFAULT 0"`
|
||||||
}
|
}
|
||||||
|
|
||||||
return x.Sync(new(Comment), new(Issue))
|
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||||
|
IgnoreConstrains: true,
|
||||||
|
IgnoreIndices: true,
|
||||||
|
}, new(Comment), new(Issue))
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
@ -13,5 +13,9 @@ func AddForcePushBranchProtection(x *xorm.Engine) error {
|
|||||||
ForcePushAllowlistTeamIDs []int64 `xorm:"JSON TEXT"`
|
ForcePushAllowlistTeamIDs []int64 `xorm:"JSON TEXT"`
|
||||||
ForcePushAllowlistDeployKeys bool `xorm:"NOT NULL DEFAULT false"`
|
ForcePushAllowlistDeployKeys bool `xorm:"NOT NULL DEFAULT false"`
|
||||||
}
|
}
|
||||||
return x.Sync(new(ProtectedBranch))
|
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||||
|
IgnoreConstrains: true,
|
||||||
|
IgnoreIndices: true,
|
||||||
|
}, new(ProtectedBranch))
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
@ -10,5 +10,9 @@ func AddSkipSecondaryAuthColumnToOAuth2ApplicationTable(x *xorm.Engine) error {
|
|||||||
type oauth2Application struct {
|
type oauth2Application struct {
|
||||||
SkipSecondaryAuthorization bool `xorm:"NOT NULL DEFAULT FALSE"`
|
SkipSecondaryAuthorization bool `xorm:"NOT NULL DEFAULT FALSE"`
|
||||||
}
|
}
|
||||||
return x.Sync(new(oauth2Application))
|
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||||
|
IgnoreConstrains: true,
|
||||||
|
IgnoreIndices: true,
|
||||||
|
}, new(oauth2Application))
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
@ -19,5 +19,9 @@ func AddCommentMetaDataColumn(x *xorm.Engine) error {
|
|||||||
CommentMetaData *CommentMetaData `xorm:"JSON TEXT"` // put all non-index metadata in a single field
|
CommentMetaData *CommentMetaData `xorm:"JSON TEXT"` // put all non-index metadata in a single field
|
||||||
}
|
}
|
||||||
|
|
||||||
return x.Sync(new(Comment))
|
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||||
|
IgnoreConstrains: true,
|
||||||
|
IgnoreIndices: true,
|
||||||
|
}, new(Comment))
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
@ -9,5 +9,9 @@ func AddBlockAdminMergeOverrideBranchProtection(x *xorm.Engine) error {
|
|||||||
type ProtectedBranch struct {
|
type ProtectedBranch struct {
|
||||||
BlockAdminMergeOverride bool `xorm:"NOT NULL DEFAULT false"`
|
BlockAdminMergeOverride bool `xorm:"NOT NULL DEFAULT false"`
|
||||||
}
|
}
|
||||||
return x.Sync(new(ProtectedBranch))
|
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||||
|
IgnoreConstrains: true,
|
||||||
|
IgnoreIndices: true,
|
||||||
|
}, new(ProtectedBranch))
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
@ -12,5 +12,9 @@ func AddPriorityToProtectedBranch(x *xorm.Engine) error {
|
|||||||
Priority int64 `xorm:"NOT NULL DEFAULT 0"`
|
Priority int64 `xorm:"NOT NULL DEFAULT 0"`
|
||||||
}
|
}
|
||||||
|
|
||||||
return x.Sync(new(ProtectedBranch))
|
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||||
|
IgnoreConstrains: true,
|
||||||
|
IgnoreIndices: true,
|
||||||
|
}, new(ProtectedBranch))
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,9 @@ func AddTimeEstimateColumnToIssueTable(x *xorm.Engine) error {
|
|||||||
type Issue struct {
|
type Issue struct {
|
||||||
TimeEstimate int64 `xorm:"NOT NULL DEFAULT 0"`
|
TimeEstimate int64 `xorm:"NOT NULL DEFAULT 0"`
|
||||||
}
|
}
|
||||||
|
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||||
return x.Sync(new(Issue))
|
IgnoreConstrains: true,
|
||||||
|
IgnoreIndices: true,
|
||||||
|
}, new(Issue))
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
@ -17,5 +17,9 @@ func (pullAutoMerge) TableName() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func AddDeleteBranchAfterMergeForAutoMerge(x *xorm.Engine) error {
|
func AddDeleteBranchAfterMergeForAutoMerge(x *xorm.Engine) error {
|
||||||
return x.Sync(new(pullAutoMerge))
|
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||||
|
IgnoreConstrains: true,
|
||||||
|
IgnoreIndices: true,
|
||||||
|
}, new(pullAutoMerge))
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,9 @@ func AddEphemeralToActionRunner(x *xorm.Engine) error {
|
|||||||
type ActionRunner struct {
|
type ActionRunner struct {
|
||||||
Ephemeral bool `xorm:"ephemeral NOT NULL DEFAULT false"`
|
Ephemeral bool `xorm:"ephemeral NOT NULL DEFAULT false"`
|
||||||
}
|
}
|
||||||
|
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||||
return x.Sync(new(ActionRunner))
|
IgnoreConstrains: true,
|
||||||
|
IgnoreIndices: true,
|
||||||
|
}, new(ActionRunner))
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
@ -16,5 +16,9 @@ func AddDescriptionForSecretsAndVariables(x *xorm.Engine) error {
|
|||||||
Description string `xorm:"TEXT"`
|
Description string `xorm:"TEXT"`
|
||||||
}
|
}
|
||||||
|
|
||||||
return x.Sync(new(Secret), new(ActionVariable))
|
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||||
|
IgnoreConstrains: true,
|
||||||
|
IgnoreIndices: true,
|
||||||
|
}, new(Secret), new(ActionVariable))
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
@ -13,5 +13,9 @@ func AddRepoUnitAnonymousAccessMode(x *xorm.Engine) error {
|
|||||||
type RepoUnit struct { //revive:disable-line:exported
|
type RepoUnit struct { //revive:disable-line:exported
|
||||||
AnonymousAccessMode perm.AccessMode `xorm:"NOT NULL DEFAULT 0"`
|
AnonymousAccessMode perm.AccessMode `xorm:"NOT NULL DEFAULT 0"`
|
||||||
}
|
}
|
||||||
return x.Sync(&RepoUnit{})
|
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||||
|
IgnoreConstrains: true,
|
||||||
|
IgnoreIndices: true,
|
||||||
|
}, new(RepoUnit))
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,9 @@ func AddExclusiveOrderColumnToLabelTable(x *xorm.Engine) error {
|
|||||||
type Label struct {
|
type Label struct {
|
||||||
ExclusiveOrder int `xorm:"DEFAULT 0"`
|
ExclusiveOrder int `xorm:"DEFAULT 0"`
|
||||||
}
|
}
|
||||||
|
_, err := x.SyncWithOptions(xorm.SyncOptions{
|
||||||
return x.Sync(new(Label))
|
IgnoreConstrains: true,
|
||||||
|
IgnoreIndices: true,
|
||||||
|
}, new(Label))
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,6 @@ func TestPullCreate_EmptyChangesWithSameCommits(t *testing.T) {
|
|||||||
|
|
||||||
func TestPullStatusDelayCheck(t *testing.T) {
|
func TestPullStatusDelayCheck(t *testing.T) {
|
||||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||||
defer test.MockVariableValue(&setting.IsProd)()
|
|
||||||
defer test.MockVariableValue(&setting.Repository.PullRequest.DelayCheckForInactiveDays, 1)()
|
defer test.MockVariableValue(&setting.Repository.PullRequest.DelayCheckForInactiveDays, 1)()
|
||||||
defer test.MockVariableValue(&pull.AddPullRequestToCheckQueue)()
|
defer test.MockVariableValue(&pull.AddPullRequestToCheckQueue)()
|
||||||
|
|
||||||
@ -203,11 +202,11 @@ func TestPullStatusDelayCheck(t *testing.T) {
|
|||||||
issue3, checkedPrID := run(t, func(t *testing.T) {})
|
issue3, checkedPrID := run(t, func(t *testing.T) {})
|
||||||
assert.Equal(t, issues.PullRequestStatusMergeable, issue3.PullRequest.Status)
|
assert.Equal(t, issues.PullRequestStatusMergeable, issue3.PullRequest.Status)
|
||||||
assert.Zero(t, checkedPrID)
|
assert.Zero(t, checkedPrID)
|
||||||
setting.IsProd = true
|
|
||||||
assertReloadingInterval(t, "") // the PR is mergeable, so no need to reload the merge box
|
assertReloadingInterval(t, "") // the PR is mergeable, so no need to reload the merge box
|
||||||
setting.IsProd = false
|
|
||||||
assertReloadingInterval(t, "1") // make sure dev mode always do merge box reloading, to make sure the UI logic won't break
|
// setting.IsProd = false // it would cause data-race because the queue handlers might be running and reading its value
|
||||||
setting.IsProd = true
|
// assertReloadingInterval(t, "1") // make sure dev mode always do merge box reloading, to make sure the UI logic won't break
|
||||||
|
// setting.IsProd = true
|
||||||
|
|
||||||
// when base branch changes, PR status should be updated, but it is inactive for long time, so no real check
|
// when base branch changes, PR status should be updated, but it is inactive for long time, so no real check
|
||||||
issue3, checkedPrID = run(t, func(t *testing.T) {
|
issue3, checkedPrID = run(t, func(t *testing.T) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user