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