aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/actions/run.go3
-rw-r--r--models/migrations/migrations.go2
-rw-r--r--models/migrations/v1_21/v275.go15
3 files changed, 19 insertions, 1 deletions
diff --git a/models/actions/run.go b/models/actions/run.go
index 4853afc15b..8078613fb8 100644
--- a/models/actions/run.go
+++ b/models/actions/run.go
@@ -35,7 +35,8 @@ type ActionRun struct {
Index int64 `xorm:"index unique(repo_index)"` // a unique number for each run of a repository
TriggerUserID int64 `xorm:"index"`
TriggerUser *user_model.User `xorm:"-"`
- Ref string `xorm:"index"` // the commit/tag/… that caused the run
+ ScheduleID int64
+ Ref string `xorm:"index"` // the commit/tag/… that caused the run
CommitSHA string
IsForkPullRequest bool // If this is triggered by a PR from a forked repository or an untrusted user, we need to check if it is approved and limit permissions when running the workflow.
NeedApproval bool // may need approval if it's a fork pull request
diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go
index 40df1cd624..f0a8b05d53 100644
--- a/models/migrations/migrations.go
+++ b/models/migrations/migrations.go
@@ -530,6 +530,8 @@ var migrations = []Migration{
NewMigration("Add Action Schedule Table", v1_21.AddActionScheduleTable),
// v274 -> v275
NewMigration("Add Actions artifacts expiration date", v1_21.AddExpiredUnixColumnInActionArtifactTable),
+ // v275 -> v276
+ NewMigration("Add ScheduleID for ActionRun", v1_21.AddScheduleIDForActionRun),
}
// GetCurrentDBVersion returns the current db version
diff --git a/models/migrations/v1_21/v275.go b/models/migrations/v1_21/v275.go
new file mode 100644
index 0000000000..78804a59d6
--- /dev/null
+++ b/models/migrations/v1_21/v275.go
@@ -0,0 +1,15 @@
+// Copyright 2023 The Gitea Authors. All rights reserved.
+// SPDX-License-Identifier: MIT
+
+package v1_21 //nolint
+
+import (
+ "xorm.io/xorm"
+)
+
+func AddScheduleIDForActionRun(x *xorm.Engine) error {
+ type ActionRun struct {
+ ScheduleID int64
+ }
+ return x.Sync(new(ActionRun))
+}