fix incomplete build query

This commit is contained in:
Brad Rydzewski 2019-03-18 23:39:33 -07:00
parent 3a1cab8164
commit a9d63cea69
3 changed files with 10 additions and 2 deletions

2
go.mod
View file

@ -17,7 +17,7 @@ require (
github.com/docker/go-units v0.3.3
github.com/drone/drone-go v0.0.0-20190217024616-3e8b71333e59
github.com/drone/drone-runtime v0.0.0-20190210191445-ad403a0ca24e
github.com/drone/drone-ui v0.0.0-20190318170755-1ca48466a158
github.com/drone/drone-ui v0.0.0-20190318215801-d6c3d11a1c3f
github.com/drone/drone-yaml v1.0.6
github.com/drone/envsubst v1.0.1
github.com/drone/go-license v1.0.2

3
go.sum
View file

@ -35,6 +35,9 @@ github.com/drone/drone-runtime v0.0.0-20190210191445-ad403a0ca24e h1:Eq0QI9lKe6T
github.com/drone/drone-runtime v0.0.0-20190210191445-ad403a0ca24e/go.mod h1:I+wJO4yvngCUAro6wKjkMbuPPDI/jRynqU0LTW+8J44=
github.com/drone/drone-ui v0.0.0-20190318170755-1ca48466a158 h1:u80WYtaGkKWVmxj1BMX9SukAqTxILzGFIKvY5as9zAc=
github.com/drone/drone-ui v0.0.0-20190318170755-1ca48466a158/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.0.0-20190318215801-d6c3d11a1c3f h1:yMdZ/2BZFKrfMbWlc0cNH2TCXdC8MsSR0pnu3Dq4UH4=
github.com/drone/drone-ui v0.0.0-20190318215801-d6c3d11a1c3f/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.8.1 h1:I4WBAlnk/YQzCggQy/Qegb8Nu2T2R9KVzxso/lL98so=
github.com/drone/drone-yaml v1.0.4 h1:NYTEGhf/XJMiJT8CwGy+pMOxWC8C2vhhzEo6/gbT4tU=
github.com/drone/drone-yaml v1.0.4/go.mod h1:eM365p3g9M5sroFBTR/najiGrZnd/GiIpWHC2UW8PoI=
github.com/drone/drone-yaml v1.0.5 h1:LC74aQhyagrBYFTI3XmLEYNkMpEq4QZSQbwiLGyHrsg=

View file

@ -443,6 +443,12 @@ WHERE perms.perm_user_id = :user_id
ORDER BY repo_slug ASC;
`
// OPTIMIZED QUERY:
// FROM repos LEFT OUTER JOIN builds ON build_id = repo_counter
// INNER JOIN perms ON perms.perm_repo_uid = repos.repo_uid
// WHERE perms.perm_user_id = 2
// ORDER BY repo_slug ASC;
const queryRepoWithBuildAll = queryColsBulds + `
FROM repos
INNER JOIN perms ON perms.perm_repo_uid = repos.repo_uid
@ -454,7 +460,6 @@ LIMIT 25;
const queryRepoWithBuildIncomplete = queryColsBulds + `
FROM repos
INNER JOIN perms ON perms.perm_repo_uid = repos.repo_uid
INNER JOIN builds ON builds.build_repo_id = repos.repo_id
WHERE EXISTS (
SELECT stage_id