forgejo/models/forgejo_migrations/v14b_add-action_run-preexecutionerrorcode.go
Mathieu Fenniak 993da59ad4 i18n: translate Actions PreExecutionError for viewer (#10267)
Identified in code review https://codeberg.org/forgejo/forgejo/pulls/10244#issuecomment-8576643, the `PreExecutionError` field in `ActionRun` isn't well implemented as it translates the error at action runtime rather than later when the action is viewed in the UI.  This PR adds an error code and error details column that can be more correctly translated.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10267
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-11-30 13:16:41 +01:00

24 lines
631 B
Go

// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
package forgejo_migrations
import (
"xorm.io/xorm"
)
func init() {
registerMigration(&Migration{
Description: "add PreExecutionErrorCode & PreExecutionErrorDetails to action_run",
Upgrade: addActionRunPreExecutionErrorCode,
})
}
func addActionRunPreExecutionErrorCode(x *xorm.Engine) error {
type ActionRun struct {
PreExecutionErrorCode int64
PreExecutionErrorDetails []any `xorm:"JSON LONGTEXT"`
}
_, err := x.SyncWithOptions(xorm.SyncOptions{IgnoreDropIndices: true}, new(ActionRun))
return err
}