File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -391,6 +391,8 @@ var migrations = []Migration{
391
391
NewMigration ("Improve Action table indices" , improveActionTableIndices ),
392
392
// v217 -> v218
393
393
NewMigration ("Alter hook_task table TEXT fields to LONGTEXT" , alterHookTaskTextFieldsToLongText ),
394
+ // v218 -> v219
395
+ NewMigration ("Add sync_on_push column to push_mirror table" , addSyncOnPushColForPushMirror ),
394
396
}
395
397
396
398
// GetCurrentDBVersion returns the current db version
Original file line number Diff line number Diff line change
1
+ // Copyright 2022 The Gitea Authors. All rights reserved.
2
+ // Use of this source code is governed by a MIT-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ package migrations
6
+
7
+ import (
8
+ "fmt"
9
+ "time"
10
+
11
+ "code.gitea.io/gitea/models/repo"
12
+ "code.gitea.io/gitea/modules/timeutil"
13
+ "xorm.io/xorm"
14
+ )
15
+
16
+ func addSyncOnPushColForPushMirror (x * xorm.Engine ) error {
17
+ type PushMirror struct {
18
+ ID int64 `xorm:"pk autoincr"`
19
+ RepoID int64 `xorm:"INDEX"`
20
+ Repo * repo.Repository `xorm:"-"`
21
+ RemoteName string
22
+
23
+ SyncOnPush bool
24
+ Interval time.Duration
25
+ CreatedUnix timeutil.TimeStamp `xorm:"created"`
26
+ LastUpdateUnix timeutil.TimeStamp `xorm:"INDEX last_update"`
27
+ LastError string `xorm:"text"`
28
+ }
29
+
30
+ if err := x .Sync2 (new (PushMirror )); err != nil {
31
+ return fmt .Errorf ("sync2: %v" , err )
32
+ }
33
+
34
+ return nil
35
+ }
You can’t perform that action at this time.
0 commit comments