diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 298ff60467..0a7a64336c 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -405,7 +405,7 @@ func prepareMigrationTasks() []*migration { newMigration(328, "Add TokenPermissions column to ActionRunJob", v1_26.AddTokenPermissionsToActionRunJob), newMigration(329, "Add unique constraint for user badge", v1_26.AddUniqueIndexForUserBadge), newMigration(330, "Add name column to webhook", v1_26.AddNameToWebhook), - newMigration(331, "Add runner capacity and job max-parallel support", v1_26.AddRunnerCapacityAndJobMaxParallel), + newMigration(331, "Add job max-parallel support", v1_26.AddJobMaxParallel), } return preparedMigrations } diff --git a/models/migrations/v1_26/v331.go b/models/migrations/v1_26/v331.go new file mode 100644 index 0000000000..d2fa98ca4e --- /dev/null +++ b/models/migrations/v1_26/v331.go @@ -0,0 +1,17 @@ +// Copyright 2026 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package v1_26 + +import "xorm.io/xorm" + +// AddJobMaxParallel adds max_parallel to action_run_job with a composite index on (run_id, job_id). +func AddJobMaxParallel(x *xorm.Engine) error { + type ActionRunJob struct { + RunID int64 `xorm:"index index(idx_run_id_job_id)"` + JobID string `xorm:"VARCHAR(255) index(idx_run_id_job_id)"` + MaxParallel int `xorm:"NOT NULL DEFAULT 0"` + } + + return x.Sync(new(ActionRunJob)) +}