You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
747 B
Go
36 lines
747 B
Go
4 years ago
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a MIT-style
|
||
|
// license that can be found in the LICENSE file.
|
||
|
|
||
2 years ago
|
package v1_14 //nolint
|
||
4 years ago
|
|
||
|
import (
|
||
3 years ago
|
"fmt"
|
||
|
|
||
4 years ago
|
"xorm.io/xorm"
|
||
|
)
|
||
|
|
||
2 years ago
|
func AddRepoTransfer(x *xorm.Engine) error {
|
||
4 years ago
|
type RepoTransfer struct {
|
||
|
ID int64 `xorm:"pk autoincr"`
|
||
|
DoerID int64
|
||
|
RecipientID int64
|
||
|
RepoID int64
|
||
|
TeamIDs []int64
|
||
|
CreatedUnix int64 `xorm:"INDEX NOT NULL created"`
|
||
|
UpdatedUnix int64 `xorm:"INDEX NOT NULL updated"`
|
||
|
}
|
||
|
|
||
3 years ago
|
sess := x.NewSession()
|
||
|
defer sess.Close()
|
||
|
if err := sess.Begin(); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
if err := sess.Sync2(new(RepoTransfer)); err != nil {
|
||
2 years ago
|
return fmt.Errorf("Sync2: %w", err)
|
||
3 years ago
|
}
|
||
|
|
||
|
return sess.Commit()
|
||
4 years ago
|
}
|