2019-12-27 15:30:58 -05:00
|
|
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
2022-11-27 13:20:29 -05:00
|
|
|
// SPDX-License-Identifier: MIT
|
2019-12-27 15:30:58 -05:00
|
|
|
|
2022-11-02 04:54:36 -04:00
|
|
|
package v1_11 //nolint
|
2019-12-27 15:30:58 -05:00
|
|
|
|
|
|
|
import (
|
|
|
|
"xorm.io/xorm"
|
|
|
|
)
|
|
|
|
|
2022-11-02 04:54:36 -04:00
|
|
|
func ExtendTrackedTimes(x *xorm.Engine) error {
|
2020-06-09 16:34:05 -04:00
|
|
|
type TrackedTime struct {
|
|
|
|
Time int64 `xorm:"NOT NULL"`
|
|
|
|
Deleted bool `xorm:"NOT NULL DEFAULT false"`
|
|
|
|
}
|
|
|
|
|
2019-12-27 15:30:58 -05:00
|
|
|
sess := x.NewSession()
|
|
|
|
defer sess.Close()
|
|
|
|
|
|
|
|
if err := sess.Begin(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
if _, err := sess.Exec("DELETE FROM tracked_time WHERE time IS NULL"); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2023-08-13 15:17:21 -04:00
|
|
|
if err := sess.Sync(new(TrackedTime)); err != nil {
|
2019-12-27 15:30:58 -05:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return sess.Commit()
|
|
|
|
}
|