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