1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 10:18:38 +00:00

Use created & updated instead BeforeInsert & BeforeUpdate (#2482)

* use created & updated instead BeforeInsert & BeforeUpdate

* fix vendor checksum

* only show generated SQL when development mode

* remove extra update column updated_unix

* remove trace config
This commit is contained in:
Lunny Xiao
2017-09-13 13:18:22 +08:00
committed by Lauris BH
parent 4c2b1be3a4
commit 005900baea
48 changed files with 519 additions and 717 deletions

View File

@@ -40,18 +40,26 @@ type Mirror struct {
// BeforeInsert will be invoked by XORM before inserting a record
func (m *Mirror) BeforeInsert() {
m.UpdatedUnix = time.Now().Unix()
m.NextUpdateUnix = m.NextUpdate.Unix()
if m != nil {
m.UpdatedUnix = time.Now().Unix()
m.NextUpdateUnix = m.NextUpdate.Unix()
}
}
// BeforeUpdate is invoked from XORM before updating this object.
func (m *Mirror) BeforeUpdate() {
m.UpdatedUnix = time.Now().Unix()
m.NextUpdateUnix = m.NextUpdate.Unix()
if m != nil {
m.UpdatedUnix = time.Now().Unix()
m.NextUpdateUnix = m.NextUpdate.Unix()
}
}
// AfterSet is invoked from XORM after setting the value of a field of this object.
func (m *Mirror) AfterSet(colName string, _ xorm.Cell) {
if m == nil {
return
}
var err error
switch colName {
case "repo_id":