2024-03-07 23:18:38 +01:00
|
|
|
// Copyright 2024 The Gitea Authors. All rights reserved.
|
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
2025-06-27 07:59:55 +02:00
|
|
|
package v1_22
|
2024-03-07 23:18:38 +01:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"xorm.io/xorm"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type HookTask struct {
|
|
|
|
|
PayloadVersion int `xorm:"DEFAULT 1"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func AddPayloadVersionToHookTaskTable(x *xorm.Engine) error {
|
|
|
|
|
// create missing column
|
2024-07-15 05:15:59 +08:00
|
|
|
if _, err := x.SyncWithOptions(xorm.SyncOptions{
|
|
|
|
|
IgnoreIndices: true,
|
|
|
|
|
IgnoreConstrains: true,
|
|
|
|
|
}, new(HookTask)); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
_, err := x.Exec("UPDATE hook_task SET payload_version = 1 WHERE payload_version IS NULL")
|
|
|
|
|
return err
|
2024-03-07 23:18:38 +01:00
|
|
|
}
|