mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-03 09:52:26 +02:00
Migrate reviews when migrating repository from github (#9463)
* fix typo * Migrate reviews when migrating repository from github * fix lint * Added test and migration when external user login * fix test * fix commented state * Some improvements * fix bug when get pull request and ref original author on code comments * Fix migrated line; Added comment for review * Don't load all pull requests attributes * Fix typo * wrong change copy head * fix tests * fix reactions * Fix test * fix fmt * fix review comment reactions
This commit is contained in:
parent
bfdfa9a8b3
commit
f6067a8465
18 changed files with 567 additions and 32 deletions
|
@ -304,6 +304,8 @@ var migrations = []Migration{
|
|||
NewMigration("Add original informations for reactions", addReactionOriginals),
|
||||
// v124 -> v125
|
||||
NewMigration("Add columns to user and repository", addUserRepoMissingColumns),
|
||||
// v125 -> v126
|
||||
NewMigration("Add some columns on review for migration", addReviewMigrateInfo),
|
||||
}
|
||||
|
||||
// Migrate database to current version
|
||||
|
|
23
models/migrations/v125.go
Normal file
23
models/migrations/v125.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2020 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.
|
||||
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func addReviewMigrateInfo(x *xorm.Engine) error {
|
||||
type Review struct {
|
||||
OriginalAuthor string
|
||||
OriginalAuthorID int64
|
||||
}
|
||||
|
||||
if err := x.Sync2(new(Review)); err != nil {
|
||||
return fmt.Errorf("Sync2: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue