diff --git a/models/actions/runner.go b/models/actions/runner.go index d50d0946aa..9ddf346aa6 100644 --- a/models/actions/runner.go +++ b/models/actions/runner.go @@ -58,7 +58,7 @@ type ActionRunner struct { // Store labels defined in state file (default: .runner file) of `act_runner` AgentLabels []string `xorm:"TEXT"` // Store if this is a runner that only ever get one single job assigned - Ephemeral bool `xorm:"ephemeral"` + Ephemeral bool `xorm:"ephemeral NOT NULL DEFAULT false"` Created timeutil.TimeStamp `xorm:"created"` Updated timeutil.TimeStamp `xorm:"updated"` diff --git a/models/migrations/v1_24/v315.go b/models/migrations/v1_24/v315.go index 52003c5dae..aefb872d0f 100644 --- a/models/migrations/v1_24/v315.go +++ b/models/migrations/v1_24/v315.go @@ -9,14 +9,8 @@ import ( func AddEphemeralToActionRunner(x *xorm.Engine) error { type ActionRunner struct { - Ephemeral bool `xorm:"ephemeral"` + Ephemeral bool `xorm:"ephemeral NOT NULL DEFAULT false"` } - if err := x.Sync(new(ActionRunner)); err != nil { - return err - } - - // update all records to set ephemeral to false - _, err := x.Exec("UPDATE `action_runner` SET `ephemeral` = false WHERE `ephemeral` IS NULL") - return err + return x.Sync(new(ActionRunner)) }