aboutsummaryrefslogtreecommitdiffstats
path: root/modules/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'modules/migrations')
-rw-r--r--modules/migrations/base/uploader.go1
-rw-r--r--modules/migrations/gitea.go7
-rw-r--r--modules/migrations/migrate.go1
3 files changed, 9 insertions, 0 deletions
diff --git a/modules/migrations/base/uploader.go b/modules/migrations/base/uploader.go
index a3a9c9fac6..ae1be84b88 100644
--- a/modules/migrations/base/uploader.go
+++ b/modules/migrations/base/uploader.go
@@ -17,4 +17,5 @@ type Uploader interface {
CreateComments(comments ...*Comment) error
CreatePullRequests(prs ...*PullRequest) error
Rollback() error
+ Close()
}
diff --git a/modules/migrations/gitea.go b/modules/migrations/gitea.go
index 676667b426..81a6116a23 100644
--- a/modules/migrations/gitea.go
+++ b/modules/migrations/gitea.go
@@ -131,6 +131,13 @@ func (g *GiteaLocalUploader) CreateRepo(repo *base.Repository, opts base.Migrate
return err
}
+// Close closes this uploader
+func (g *GiteaLocalUploader) Close() {
+ if g.gitRepo != nil {
+ g.gitRepo.Close()
+ }
+}
+
// CreateTopics creates topics
func (g *GiteaLocalUploader) CreateTopics(topics ...string) error {
return models.SaveTopics(g.repo.ID, topics...)
diff --git a/modules/migrations/migrate.go b/modules/migrations/migrate.go
index bbc1dc2d56..7a5071e125 100644
--- a/modules/migrations/migrate.go
+++ b/modules/migrations/migrate.go
@@ -94,6 +94,7 @@ func migrateRepository(downloader base.Downloader, uploader base.Uploader, opts
if err := uploader.CreateRepo(repo, opts); err != nil {
return err
}
+ defer uploader.Close()
log.Trace("migrating topics")
topics, err := downloader.GetTopics()