summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/migrations/base/uploader.go1
-rw-r--r--modules/migrations/gitea.go9
-rw-r--r--modules/migrations/migrate.go5
3 files changed, 11 insertions, 4 deletions
diff --git a/modules/migrations/base/uploader.go b/modules/migrations/base/uploader.go
index ae1be84b88..257c7a2909 100644
--- a/modules/migrations/base/uploader.go
+++ b/modules/migrations/base/uploader.go
@@ -12,6 +12,7 @@ type Uploader interface {
CreateTopics(topic ...string) error
CreateMilestones(milestones ...*Milestone) error
CreateReleases(releases ...*Release) error
+ SyncTags() error
CreateLabels(labels ...*Label) error
CreateIssues(issues ...*Issue) error
CreateComments(comments ...*Comment) error
diff --git a/modules/migrations/gitea.go b/modules/migrations/gitea.go
index 81a6116a23..18f4da7584 100644
--- a/modules/migrations/gitea.go
+++ b/modules/migrations/gitea.go
@@ -288,11 +288,12 @@ func (g *GiteaLocalUploader) CreateReleases(releases ...*base.Release) error {
rels = append(rels, &rel)
}
- if err := models.InsertReleases(rels...); err != nil {
- return err
- }
- // sync tags to releases in database
+ return models.InsertReleases(rels...)
+}
+
+// SyncTags syncs releases with tags in the database
+func (g *GiteaLocalUploader) SyncTags() error {
return models.SyncReleasesWithTags(g.repo, g.gitRepo)
}
diff --git a/modules/migrations/migrate.go b/modules/migrations/migrate.go
index 7a5071e125..e2a2c8b7ec 100644
--- a/modules/migrations/migrate.go
+++ b/modules/migrations/migrate.go
@@ -165,6 +165,11 @@ func migrateRepository(downloader base.Downloader, uploader base.Uploader, opts
}
releases = releases[relBatchSize:]
}
+
+ // Once all releases (if any) are inserted, sync any remaining non-release tags
+ if err := uploader.SyncTags(); err != nil {
+ return err
+ }
}
var commentBatchSize = uploader.MaxBatchInsertSize("comment")