diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-28 22:11:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-28 22:11:58 +0800 |
commit | 9defddb2862aa0a54da21328ca091284291363f7 (patch) | |
tree | 1126670579198f00d89c8a4f0240aa7d99995eb8 /models/migrate.go | |
parent | b1df89095163d8ce3eecfeb855e7f03f17b473c4 (diff) | |
download | gitea-9defddb2862aa0a54da21328ca091284291363f7.tar.gz gitea-9defddb2862aa0a54da21328ca091284291363f7.zip |
Move more model into models/user (#17826)
* Move more model into models/user
* Remove unnecessary comment
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'models/migrate.go')
-rw-r--r-- | models/migrate.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/models/migrate.go b/models/migrate.go index efe4bd0c5e..07d2b0f2d9 100644 --- a/models/migrate.go +++ b/models/migrate.go @@ -245,3 +245,23 @@ func UpdateReviewsMigrationsByType(tp structs.GitServiceType, originalAuthorID s }) return err } + +// UpdateMigrationsByType updates all migrated repositories' posterid from gitServiceType to replace originalAuthorID to posterID +func UpdateMigrationsByType(tp structs.GitServiceType, externalUserID string, userID int64) error { + if err := UpdateIssuesMigrationsByType(tp, externalUserID, userID); err != nil { + return err + } + + if err := UpdateCommentsMigrationsByType(tp, externalUserID, userID); err != nil { + return err + } + + if err := UpdateReleasesMigrationsByType(tp, externalUserID, userID); err != nil { + return err + } + + if err := UpdateReactionsMigrationsByType(tp, externalUserID, userID); err != nil { + return err + } + return UpdateReviewsMigrationsByType(tp, externalUserID, userID) +} |