code.gitea.io/gitea@v1.21.7/models/migrations/v1_17/v219.go (about)

     1  // Copyright 2022 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package v1_17 //nolint
     5  
     6  import (
     7  	"time"
     8  
     9  	"code.gitea.io/gitea/models/repo"
    10  	"code.gitea.io/gitea/modules/timeutil"
    11  
    12  	"xorm.io/xorm"
    13  )
    14  
    15  func AddSyncOnCommitColForPushMirror(x *xorm.Engine) error {
    16  	type PushMirror struct {
    17  		ID         int64            `xorm:"pk autoincr"`
    18  		RepoID     int64            `xorm:"INDEX"`
    19  		Repo       *repo.Repository `xorm:"-"`
    20  		RemoteName string
    21  
    22  		SyncOnCommit   bool `xorm:"NOT NULL DEFAULT true"`
    23  		Interval       time.Duration
    24  		CreatedUnix    timeutil.TimeStamp `xorm:"created"`
    25  		LastUpdateUnix timeutil.TimeStamp `xorm:"INDEX last_update"`
    26  		LastError      string             `xorm:"text"`
    27  	}
    28  
    29  	return x.Sync(new(PushMirror))
    30  }