2022-07-08 19:45:12 +00:00
|
|
|
// Copyright 2022 The Gitea Authors. All rights reserved.
|
2022-11-27 18:20:29 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2022-07-08 19:45:12 +00:00
|
|
|
|
2022-12-08 08:21:37 +00:00
|
|
|
package v1_17 //nolint
|
2022-07-08 19:45:12 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/models/repo"
|
|
|
|
"code.gitea.io/gitea/modules/timeutil"
|
2022-07-15 13:01:32 +00:00
|
|
|
|
2022-07-08 19:45:12 +00:00
|
|
|
"xorm.io/xorm"
|
|
|
|
)
|
|
|
|
|
2022-11-02 08:54:36 +00:00
|
|
|
func AddSyncOnCommitColForPushMirror(x *xorm.Engine) error {
|
2022-07-08 19:45:12 +00:00
|
|
|
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))
|
|
|
|
}
|