2022-07-08 15:45:12 -04:00
|
|
|
// Copyright 2022 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 (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/models/repo"
|
|
|
|
"code.gitea.io/gitea/modules/timeutil"
|
2022-07-15 09:01:32 -04:00
|
|
|
|
2022-07-08 15:45:12 -04:00
|
|
|
"xorm.io/xorm"
|
|
|
|
)
|
|
|
|
|
|
|
|
func addSyncOnCommitColForPushMirror(x *xorm.Engine) error {
|
|
|
|
type PushMirror struct {
|
|
|
|
ID int64 `xorm:"pk autoincr"`
|
|
|
|
RepoID int64 `xorm:"INDEX"`
|
|
|
|
Repo *repo.Repository `xorm:"-"`
|
|
|
|
RemoteName string
|
|
|
|
|
|
|
|
SyncOnCommit bool `xorm:"NOT NULL DEFAULT true"`
|
|
|
|
Interval time.Duration
|
|
|
|
CreatedUnix timeutil.TimeStamp `xorm:"created"`
|
|
|
|
LastUpdateUnix timeutil.TimeStamp `xorm:"INDEX last_update"`
|
|
|
|
LastError string `xorm:"text"`
|
|
|
|
}
|
|
|
|
|
|
|
|
return x.Sync2(new(PushMirror))
|
|
|
|
}
|