diff options
author | Jason Song <i@wolfogre.com> | 2023-08-21 22:07:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-21 14:07:52 +0000 |
commit | 8cf3b61fb9e43c773f3ca975874d0f0e69210d44 (patch) | |
tree | 01aa1fb5ca4d545fb4665ebe32532f64b60b92a4 /models/migrations | |
parent | 42cbe6005adfe6e1440cdc9c15a05996f065bf83 (diff) | |
download | gitea-8cf3b61fb9e43c773f3ca975874d0f0e69210d44.tar.gz gitea-8cf3b61fb9e43c773f3ca975874d0f0e69210d44.zip |
Add optimistic lock to ActionRun table (#26563)
Should fix #26559.
How xorm works: https://xorm.io/docs/chapter-06/1.lock/
---------
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'models/migrations')
-rw-r--r-- | models/migrations/migrations.go | 2 | ||||
-rw-r--r-- | models/migrations/v1_21/v272.go | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 7a126593d1..87c597b573 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -524,6 +524,8 @@ var migrations = []Migration{ NewMigration("Fix PackageProperty typo", v1_21.FixPackagePropertyTypo), // v271 -> v272 NewMigration("Allow archiving labels", v1_21.AddArchivedUnixColumInLabelTable), + // v272 -> v273 + NewMigration("Add Version to ActionRun table", v1_21.AddVersionToActionRunTable), } // GetCurrentDBVersion returns the current db version diff --git a/models/migrations/v1_21/v272.go b/models/migrations/v1_21/v272.go new file mode 100644 index 0000000000..a729c49f1b --- /dev/null +++ b/models/migrations/v1_21/v272.go @@ -0,0 +1,14 @@ +// Copyright 2023 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package v1_21 //nolint +import ( + "xorm.io/xorm" +) + +func AddVersionToActionRunTable(x *xorm.Engine) error { + type ActionRun struct { + Version int `xorm:"version default 0"` + } + return x.Sync(new(ActionRun)) +} |