summaryrefslogtreecommitdiffstats
path: root/models/task.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/task.go')
-rw-r--r--models/task.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/models/task.go b/models/task.go
index 0720d28610..5528573ca5 100644
--- a/models/task.go
+++ b/models/task.go
@@ -181,12 +181,12 @@ func GetMigratingTask(repoID int64) (*Task, error) {
return &task, nil
}
-// HasMigratingTask returns if migrating task exist for repo.
-func HasMigratingTask(repoID int64) (bool, error) {
- return db.GetEngine(db.DefaultContext).Exist(&Task{
- RepoID: repoID,
- Type: structs.TaskTypeMigrateRepo,
- })
+// HasFinishedMigratingTask returns if a finished migration task exists for the repo.
+func HasFinishedMigratingTask(repoID int64) (bool, error) {
+ return db.GetEngine(db.DefaultContext).
+ Where("repo_id=? AND type=? AND status=?", repoID, structs.TaskTypeMigrateRepo, structs.TaskStatusFinished).
+ Table("task").
+ Exist()
}
// GetMigratingTaskByID returns the migrating task by repo's id