0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-05-06 23:38:48 +02:00

feat: Adapt the migration

This commit is contained in:
Pascal Zimmermann 2026-04-01 08:18:34 +02:00
parent c06bfe95e5
commit 66ee950a42
2 changed files with 18 additions and 1 deletions

View File

@ -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
}

View File

@ -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))
}