2018-02-19 03:39:26 +01:00
|
|
|
// Copyright 2017 The Gitea Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package migrations
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2019-08-15 16:46:21 +02:00
|
|
|
"code.gitea.io/gitea/modules/timeutil"
|
2018-02-19 03:39:26 +01:00
|
|
|
|
2019-10-17 11:26:49 +02:00
|
|
|
"xorm.io/xorm"
|
2018-02-19 03:39:26 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func addIssueClosedTime(x *xorm.Engine) error {
|
|
|
|
// Issue see models/issue.go
|
|
|
|
type Issue struct {
|
2019-08-15 16:46:21 +02:00
|
|
|
ClosedUnix timeutil.TimeStamp `xorm:"INDEX"`
|
2018-02-19 03:39:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if err := x.Sync2(new(Issue)); err != nil {
|
|
|
|
return fmt.Errorf("Sync2: %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if _, err := x.Exec("UPDATE `issue` SET `closed_unix` = `updated_unix` WHERE `is_closed` = ?", true); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|