1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Add global lock for migrations to make upgrade more safe with multiple replications (#33706)

This commit is contained in:
Lunny Xiao
2025-03-07 13:08:53 -08:00
committed by GitHub
parent b8c2afdc5f
commit 1b2dffff8e
10 changed files with 46 additions and 18 deletions

View File

@@ -4,6 +4,7 @@
package cmd
import (
"context"
"fmt"
golog "log"
"os"
@@ -130,8 +131,8 @@ func runRecreateTable(ctx *cli.Context) error {
}
recreateTables := migrate_base.RecreateTables(beans...)
return db.InitEngineWithMigration(stdCtx, func(x *xorm.Engine) error {
if err := migrations.EnsureUpToDate(x); err != nil {
return db.InitEngineWithMigration(stdCtx, func(ctx context.Context, x *xorm.Engine) error {
if err := migrations.EnsureUpToDate(ctx, x); err != nil {
return err
}
return recreateTables(x)