aboutsummaryrefslogtreecommitdiffstats
path: root/services/migrations/update.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/migrations/update.go')
-rw-r--r--services/migrations/update.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/services/migrations/update.go b/services/migrations/update.go
index d466832363..4a49206f82 100644
--- a/services/migrations/update.go
+++ b/services/migrations/update.go
@@ -36,8 +36,7 @@ func updateMigrationPosterIDByGitService(ctx context.Context, tp structs.GitServ
}
const batchSize = 100
- var start int
- for {
+ for page := 0; ; page++ {
select {
case <-ctx.Done():
log.Warn("UpdateMigrationPosterIDByGitService(%s) cancelled", tp.Name())
@@ -45,10 +44,13 @@ func updateMigrationPosterIDByGitService(ctx context.Context, tp structs.GitServ
default:
}
- users, err := user_model.FindExternalUsersByProvider(ctx, user_model.FindExternalUserOptions{
+ users, err := db.Find[user_model.ExternalLoginUser](ctx, user_model.FindExternalUserOptions{
+ ListOptions: db.ListOptions{
+ PageSize: batchSize,
+ Page: page,
+ },
Provider: provider,
- Start: start,
- Limit: batchSize,
+ OrderBy: "login_source_id ASC, external_id ASC",
})
if err != nil {
return err
@@ -70,7 +72,6 @@ func updateMigrationPosterIDByGitService(ctx context.Context, tp structs.GitServ
if len(users) < batchSize {
break
}
- start += len(users)
}
return nil
}