diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-07-07 03:24:50 +0800 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-07-06 15:24:50 -0400 |
commit | 337d6915ff8967637ff515108612c3a7a4f51585 (patch) | |
tree | 702e0f4d310fa03a635c27ab0e7c1702aac3196d /modules/migrations/gitea.go | |
parent | ef57fe4ae3c517a0bb10b81a641fb76976f404d3 (diff) | |
download | gitea-337d6915ff8967637ff515108612c3a7a4f51585.tar.gz gitea-337d6915ff8967637ff515108612c3a7a4f51585.zip |
Detect migrating batch size (#7353)
* Make migrating batch size as configurable
* detect different table batch insert size and remove config item
* remove unrelated changes
Diffstat (limited to 'modules/migrations/gitea.go')
-rw-r--r-- | modules/migrations/gitea.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/migrations/gitea.go b/modules/migrations/gitea.go index bfc5e49033..1df824c94f 100644 --- a/modules/migrations/gitea.go +++ b/modules/migrations/gitea.go @@ -53,6 +53,25 @@ func NewGiteaLocalUploader(doer *models.User, repoOwner, repoName string) *Gitea } } +// MaxBatchInsertSize returns the table's max batch insert size +func (g *GiteaLocalUploader) MaxBatchInsertSize(tp string) int { + switch tp { + case "issue": + return models.MaxBatchInsertSize(new(models.Issue)) + case "comment": + return models.MaxBatchInsertSize(new(models.Comment)) + case "milestone": + return models.MaxBatchInsertSize(new(models.Milestone)) + case "label": + return models.MaxBatchInsertSize(new(models.Label)) + case "release": + return models.MaxBatchInsertSize(new(models.Release)) + case "pullrequest": + return models.MaxBatchInsertSize(new(models.PullRequest)) + } + return 10 +} + // CreateRepo creates a repository func (g *GiteaLocalUploader) CreateRepo(repo *base.Repository, opts base.MigrateOptions) error { owner, err := models.GetUserByName(g.repoOwner) |