diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-04-08 17:11:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-08 17:11:15 +0800 |
commit | 1dfa26e00e8e1ce6f6125335871da1d402a63466 (patch) | |
tree | d39414fb085ae52d6633ae9d064aabab2e7f75f8 /services/migrations | |
parent | 84ceaa98bd731431c7d3a7f65e59e7ad076a540f (diff) | |
download | gitea-1dfa26e00e8e1ce6f6125335871da1d402a63466.tar.gz gitea-1dfa26e00e8e1ce6f6125335871da1d402a63466.zip |
Move milestone to models/issues/ (#19278)
* Move milestone to models/issues/
* Fix lint
* Fix test
* Fix lint
* Fix lint
Diffstat (limited to 'services/migrations')
-rw-r--r-- | services/migrations/gitea_uploader.go | 6 | ||||
-rw-r--r-- | services/migrations/gitea_uploader_test.go | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/services/migrations/gitea_uploader.go b/services/migrations/gitea_uploader.go index 9d2a7eb41b..8529f24895 100644 --- a/services/migrations/gitea_uploader.go +++ b/services/migrations/gitea_uploader.go @@ -79,7 +79,7 @@ func (g *GiteaLocalUploader) MaxBatchInsertSize(tp string) int { case "comment": return db.MaxBatchInsertSize(new(models.Comment)) case "milestone": - return db.MaxBatchInsertSize(new(models.Milestone)) + return db.MaxBatchInsertSize(new(issues_model.Milestone)) case "label": return db.MaxBatchInsertSize(new(models.Label)) case "release": @@ -164,7 +164,7 @@ func (g *GiteaLocalUploader) CreateTopics(topics ...string) error { // CreateMilestones creates milestones func (g *GiteaLocalUploader) CreateMilestones(milestones ...*base.Milestone) error { - mss := make([]*models.Milestone, 0, len(milestones)) + mss := make([]*issues_model.Milestone, 0, len(milestones)) for _, milestone := range milestones { var deadline timeutil.TimeStamp if milestone.Deadline != nil { @@ -187,7 +187,7 @@ func (g *GiteaLocalUploader) CreateMilestones(milestones ...*base.Milestone) err milestone.Updated = &milestone.Created } - ms := models.Milestone{ + ms := issues_model.Milestone{ RepoID: g.repo.ID, Name: milestone.Title, Content: milestone.Description, diff --git a/services/migrations/gitea_uploader_test.go b/services/migrations/gitea_uploader_test.go index ad5caa4279..51c7ad9717 100644 --- a/services/migrations/gitea_uploader_test.go +++ b/services/migrations/gitea_uploader_test.go @@ -17,6 +17,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/db" + issues_model "code.gitea.io/gitea/models/issues" repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" @@ -65,14 +66,14 @@ func TestGiteaUploadRepo(t *testing.T) { assert.True(t, repo.HasWiki()) assert.EqualValues(t, repo_model.RepositoryReady, repo.Status) - milestones, _, err := models.GetMilestones(models.GetMilestonesOption{ + milestones, _, err := issues_model.GetMilestones(issues_model.GetMilestonesOption{ RepoID: repo.ID, State: structs.StateOpen, }) assert.NoError(t, err) assert.Len(t, milestones, 1) - milestones, _, err = models.GetMilestones(models.GetMilestonesOption{ + milestones, _, err = issues_model.GetMilestones(issues_model.GetMilestonesOption{ RepoID: repo.ID, State: structs.StateClosed, }) |