Upgrade xorm to v1.3.9 and improve some migrations Sync (#29899)

Co-authored-by: 6543 <6543@obermui.de>
(cherry picked from commit 0d08bb6112884411eb4f58b056278d3c824a8fc0)
This commit is contained in:
Lunny Xiao 2024-07-15 05:15:59 +08:00 committed by Gergely Nagy
parent d0227c236a
commit 54f2dcff9d
No known key found for this signature in database
7 changed files with 36 additions and 7 deletions

View file

@ -35,5 +35,12 @@ type HookTask struct {
func AddPayloadVersionToHookTaskTable(x *xorm.Engine) error {
// create missing column
return x.Sync(new(HookTask))
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
}