2015-06-13 23:48:06 +00:00
|
|
|
package builtin
|
|
|
|
|
|
|
|
// DO NOT EDIT
|
|
|
|
// code generated by go:generate
|
|
|
|
|
|
|
|
import (
|
|
|
|
"database/sql"
|
|
|
|
"encoding/json"
|
|
|
|
|
|
|
|
. "github.com/drone/drone/pkg/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
var _ = json.Marshal
|
|
|
|
|
|
|
|
// generic database interface, matching both *sql.Db and *sql.Tx
|
2015-06-23 03:45:08 +00:00
|
|
|
type buildDB interface {
|
2015-06-13 23:48:06 +00:00
|
|
|
Exec(query string, args ...interface{}) (sql.Result, error)
|
|
|
|
Query(query string, args ...interface{}) (*sql.Rows, error)
|
|
|
|
QueryRow(query string, args ...interface{}) *sql.Row
|
|
|
|
}
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
func getBuild(db buildDB, query string, args ...interface{}) (*Build, error) {
|
2015-06-13 23:48:06 +00:00
|
|
|
row := db.QueryRow(query, args...)
|
2015-06-23 03:45:08 +00:00
|
|
|
return scanBuild(row)
|
2015-06-13 23:48:06 +00:00
|
|
|
}
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
func getBuilds(db buildDB, query string, args ...interface{}) ([]*Build, error) {
|
2015-06-13 23:48:06 +00:00
|
|
|
rows, err := db.Query(query, args...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
defer rows.Close()
|
2015-06-23 03:45:08 +00:00
|
|
|
return scanBuilds(rows)
|
2015-06-13 23:48:06 +00:00
|
|
|
}
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
func createBuild(db buildDB, query string, v *Build) error {
|
2015-06-13 23:48:06 +00:00
|
|
|
var v0 int64
|
2015-06-19 00:36:52 +00:00
|
|
|
var v1 int
|
|
|
|
var v2 string
|
2015-06-23 03:45:08 +00:00
|
|
|
var v3 int64
|
2015-06-13 23:48:06 +00:00
|
|
|
var v4 int64
|
2015-06-23 03:45:08 +00:00
|
|
|
var v5 string
|
|
|
|
var v6 string
|
|
|
|
var v7 string
|
|
|
|
var v8 string
|
|
|
|
var v9 string
|
|
|
|
var v10 string
|
|
|
|
var v11 string
|
|
|
|
var v12 string
|
|
|
|
var v13 int
|
|
|
|
var v14 string
|
|
|
|
var v15 string
|
|
|
|
var v16 string
|
|
|
|
var v17 string
|
|
|
|
var v18 string
|
|
|
|
var v19 string
|
|
|
|
var v20 string
|
|
|
|
var v21 string
|
|
|
|
var v22 string
|
|
|
|
v0 = v.RepoID
|
2015-06-19 00:36:52 +00:00
|
|
|
v1 = v.Number
|
|
|
|
v2 = v.Status
|
2015-06-23 03:45:08 +00:00
|
|
|
v3 = v.Started
|
|
|
|
v4 = v.Finished
|
|
|
|
if v.Commit != nil {
|
|
|
|
v5 = v.Commit.Sha
|
|
|
|
v6 = v.Commit.Ref
|
|
|
|
v7 = v.Commit.Branch
|
|
|
|
v8 = v.Commit.Message
|
|
|
|
v9 = v.Commit.Timestamp
|
|
|
|
v10 = v.Commit.Remote
|
|
|
|
if v.Commit.Author != nil {
|
|
|
|
v11 = v.Commit.Author.Login
|
|
|
|
v12 = v.Commit.Author.Email
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if v.PullRequest != nil {
|
|
|
|
v13 = v.PullRequest.Number
|
|
|
|
v14 = v.PullRequest.Title
|
|
|
|
if v.PullRequest.Base != nil {
|
|
|
|
v15 = v.PullRequest.Base.Sha
|
|
|
|
v16 = v.PullRequest.Base.Ref
|
|
|
|
v17 = v.PullRequest.Base.Branch
|
|
|
|
v18 = v.PullRequest.Base.Message
|
|
|
|
v19 = v.PullRequest.Base.Timestamp
|
|
|
|
v20 = v.PullRequest.Base.Remote
|
|
|
|
if v.PullRequest.Base.Author != nil {
|
|
|
|
v21 = v.PullRequest.Base.Author.Login
|
|
|
|
v22 = v.PullRequest.Base.Author.Email
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-06-13 23:48:06 +00:00
|
|
|
|
|
|
|
res, err := db.Exec(query,
|
|
|
|
&v0,
|
|
|
|
&v1,
|
|
|
|
&v2,
|
|
|
|
&v3,
|
|
|
|
&v4,
|
|
|
|
&v5,
|
|
|
|
&v6,
|
2015-06-23 03:45:08 +00:00
|
|
|
&v7,
|
|
|
|
&v8,
|
|
|
|
&v9,
|
|
|
|
&v10,
|
|
|
|
&v11,
|
|
|
|
&v12,
|
|
|
|
&v13,
|
|
|
|
&v14,
|
|
|
|
&v15,
|
|
|
|
&v16,
|
|
|
|
&v17,
|
|
|
|
&v18,
|
|
|
|
&v19,
|
|
|
|
&v20,
|
|
|
|
&v21,
|
|
|
|
&v22,
|
2015-06-13 23:48:06 +00:00
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
v.ID, err = res.LastInsertId()
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
func updateBuild(db buildDB, query string, v *Build) error {
|
2015-06-13 23:48:06 +00:00
|
|
|
var v0 int64
|
|
|
|
var v1 int64
|
2015-06-19 00:36:52 +00:00
|
|
|
var v2 int
|
|
|
|
var v3 string
|
2015-06-23 03:45:08 +00:00
|
|
|
var v4 int64
|
2015-06-13 23:48:06 +00:00
|
|
|
var v5 int64
|
2015-06-23 03:45:08 +00:00
|
|
|
var v6 string
|
|
|
|
var v7 string
|
|
|
|
var v8 string
|
|
|
|
var v9 string
|
|
|
|
var v10 string
|
|
|
|
var v11 string
|
|
|
|
var v12 string
|
|
|
|
var v13 string
|
|
|
|
var v14 int
|
|
|
|
var v15 string
|
|
|
|
var v16 string
|
|
|
|
var v17 string
|
|
|
|
var v18 string
|
|
|
|
var v19 string
|
|
|
|
var v20 string
|
|
|
|
var v21 string
|
|
|
|
var v22 string
|
|
|
|
var v23 string
|
2015-06-13 23:48:06 +00:00
|
|
|
v0 = v.ID
|
2015-06-23 03:45:08 +00:00
|
|
|
v1 = v.RepoID
|
2015-06-19 00:36:52 +00:00
|
|
|
v2 = v.Number
|
|
|
|
v3 = v.Status
|
2015-06-23 03:45:08 +00:00
|
|
|
v4 = v.Started
|
|
|
|
v5 = v.Finished
|
|
|
|
if v.Commit != nil {
|
|
|
|
v6 = v.Commit.Sha
|
|
|
|
v7 = v.Commit.Ref
|
|
|
|
v8 = v.Commit.Branch
|
|
|
|
v9 = v.Commit.Message
|
|
|
|
v10 = v.Commit.Timestamp
|
|
|
|
v11 = v.Commit.Remote
|
|
|
|
if v.Commit.Author != nil {
|
|
|
|
v12 = v.Commit.Author.Login
|
|
|
|
v13 = v.Commit.Author.Email
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if v.PullRequest != nil {
|
|
|
|
v14 = v.PullRequest.Number
|
|
|
|
v15 = v.PullRequest.Title
|
|
|
|
if v.PullRequest.Base != nil {
|
|
|
|
v16 = v.PullRequest.Base.Sha
|
|
|
|
v17 = v.PullRequest.Base.Ref
|
|
|
|
v18 = v.PullRequest.Base.Branch
|
|
|
|
v19 = v.PullRequest.Base.Message
|
|
|
|
v20 = v.PullRequest.Base.Timestamp
|
|
|
|
v21 = v.PullRequest.Base.Remote
|
|
|
|
if v.PullRequest.Base.Author != nil {
|
|
|
|
v22 = v.PullRequest.Base.Author.Login
|
|
|
|
v23 = v.PullRequest.Base.Author.Email
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-06-13 23:48:06 +00:00
|
|
|
|
|
|
|
_, err := db.Exec(query,
|
|
|
|
&v1,
|
|
|
|
&v2,
|
|
|
|
&v3,
|
|
|
|
&v4,
|
|
|
|
&v5,
|
|
|
|
&v6,
|
|
|
|
&v7,
|
2015-06-23 03:45:08 +00:00
|
|
|
&v8,
|
|
|
|
&v9,
|
|
|
|
&v10,
|
|
|
|
&v11,
|
|
|
|
&v12,
|
|
|
|
&v13,
|
|
|
|
&v14,
|
|
|
|
&v15,
|
|
|
|
&v16,
|
|
|
|
&v17,
|
|
|
|
&v18,
|
|
|
|
&v19,
|
|
|
|
&v20,
|
|
|
|
&v21,
|
|
|
|
&v22,
|
|
|
|
&v23,
|
2015-06-13 23:48:06 +00:00
|
|
|
&v0,
|
|
|
|
)
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
func scanBuild(row *sql.Row) (*Build, error) {
|
2015-06-13 23:48:06 +00:00
|
|
|
var v0 int64
|
|
|
|
var v1 int64
|
2015-06-19 00:36:52 +00:00
|
|
|
var v2 int
|
|
|
|
var v3 string
|
2015-06-23 03:45:08 +00:00
|
|
|
var v4 int64
|
2015-06-13 23:48:06 +00:00
|
|
|
var v5 int64
|
2015-06-23 03:45:08 +00:00
|
|
|
var v6 string
|
|
|
|
var v7 string
|
|
|
|
var v8 string
|
|
|
|
var v9 string
|
|
|
|
var v10 string
|
|
|
|
var v11 string
|
|
|
|
var v12 string
|
|
|
|
var v13 string
|
|
|
|
var v14 int
|
|
|
|
var v15 string
|
|
|
|
var v16 string
|
|
|
|
var v17 string
|
|
|
|
var v18 string
|
|
|
|
var v19 string
|
|
|
|
var v20 string
|
|
|
|
var v21 string
|
|
|
|
var v22 string
|
|
|
|
var v23 string
|
2015-06-13 23:48:06 +00:00
|
|
|
|
|
|
|
err := row.Scan(
|
|
|
|
&v0,
|
|
|
|
&v1,
|
|
|
|
&v2,
|
|
|
|
&v3,
|
|
|
|
&v4,
|
|
|
|
&v5,
|
|
|
|
&v6,
|
|
|
|
&v7,
|
2015-06-23 03:45:08 +00:00
|
|
|
&v8,
|
|
|
|
&v9,
|
|
|
|
&v10,
|
|
|
|
&v11,
|
|
|
|
&v12,
|
|
|
|
&v13,
|
|
|
|
&v14,
|
|
|
|
&v15,
|
|
|
|
&v16,
|
|
|
|
&v17,
|
|
|
|
&v18,
|
|
|
|
&v19,
|
|
|
|
&v20,
|
|
|
|
&v21,
|
|
|
|
&v22,
|
|
|
|
&v23,
|
2015-06-13 23:48:06 +00:00
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
v := &Build{}
|
2015-06-13 23:48:06 +00:00
|
|
|
v.ID = v0
|
2015-06-23 03:45:08 +00:00
|
|
|
v.RepoID = v1
|
2015-06-19 00:36:52 +00:00
|
|
|
v.Number = v2
|
|
|
|
v.Status = v3
|
2015-06-23 03:45:08 +00:00
|
|
|
v.Started = v4
|
|
|
|
v.Finished = v5
|
|
|
|
v.Commit = &Commit{}
|
|
|
|
v.Commit.Sha = v6
|
|
|
|
v.Commit.Ref = v7
|
|
|
|
v.Commit.Branch = v8
|
|
|
|
v.Commit.Message = v9
|
|
|
|
v.Commit.Timestamp = v10
|
|
|
|
v.Commit.Remote = v11
|
|
|
|
v.Commit.Author = &Author{}
|
|
|
|
v.Commit.Author.Login = v12
|
|
|
|
v.Commit.Author.Email = v13
|
|
|
|
v.PullRequest = &PullRequest{}
|
|
|
|
v.PullRequest.Number = v14
|
|
|
|
v.PullRequest.Title = v15
|
|
|
|
v.PullRequest.Base = &Commit{}
|
|
|
|
v.PullRequest.Base.Sha = v16
|
|
|
|
v.PullRequest.Base.Ref = v17
|
|
|
|
v.PullRequest.Base.Branch = v18
|
|
|
|
v.PullRequest.Base.Message = v19
|
|
|
|
v.PullRequest.Base.Timestamp = v20
|
|
|
|
v.PullRequest.Base.Remote = v21
|
|
|
|
v.PullRequest.Base.Author = &Author{}
|
|
|
|
v.PullRequest.Base.Author.Login = v22
|
|
|
|
v.PullRequest.Base.Author.Email = v23
|
2015-06-13 23:48:06 +00:00
|
|
|
|
|
|
|
return v, nil
|
|
|
|
}
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
func scanBuilds(rows *sql.Rows) ([]*Build, error) {
|
2015-06-13 23:48:06 +00:00
|
|
|
var err error
|
2015-06-23 03:45:08 +00:00
|
|
|
var vv []*Build
|
2015-06-13 23:48:06 +00:00
|
|
|
for rows.Next() {
|
|
|
|
var v0 int64
|
|
|
|
var v1 int64
|
2015-06-19 00:36:52 +00:00
|
|
|
var v2 int
|
|
|
|
var v3 string
|
2015-06-23 03:45:08 +00:00
|
|
|
var v4 int64
|
2015-06-13 23:48:06 +00:00
|
|
|
var v5 int64
|
2015-06-23 03:45:08 +00:00
|
|
|
var v6 string
|
|
|
|
var v7 string
|
|
|
|
var v8 string
|
|
|
|
var v9 string
|
|
|
|
var v10 string
|
|
|
|
var v11 string
|
|
|
|
var v12 string
|
|
|
|
var v13 string
|
|
|
|
var v14 int
|
|
|
|
var v15 string
|
|
|
|
var v16 string
|
|
|
|
var v17 string
|
|
|
|
var v18 string
|
|
|
|
var v19 string
|
|
|
|
var v20 string
|
|
|
|
var v21 string
|
|
|
|
var v22 string
|
|
|
|
var v23 string
|
2015-06-13 23:48:06 +00:00
|
|
|
err = rows.Scan(
|
|
|
|
&v0,
|
|
|
|
&v1,
|
|
|
|
&v2,
|
|
|
|
&v3,
|
|
|
|
&v4,
|
|
|
|
&v5,
|
|
|
|
&v6,
|
|
|
|
&v7,
|
2015-06-23 03:45:08 +00:00
|
|
|
&v8,
|
|
|
|
&v9,
|
|
|
|
&v10,
|
|
|
|
&v11,
|
|
|
|
&v12,
|
|
|
|
&v13,
|
|
|
|
&v14,
|
|
|
|
&v15,
|
|
|
|
&v16,
|
|
|
|
&v17,
|
|
|
|
&v18,
|
|
|
|
&v19,
|
|
|
|
&v20,
|
|
|
|
&v21,
|
|
|
|
&v22,
|
|
|
|
&v23,
|
2015-06-13 23:48:06 +00:00
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
return vv, err
|
|
|
|
}
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
v := &Build{}
|
2015-06-13 23:48:06 +00:00
|
|
|
v.ID = v0
|
2015-06-23 03:45:08 +00:00
|
|
|
v.RepoID = v1
|
2015-06-19 00:36:52 +00:00
|
|
|
v.Number = v2
|
|
|
|
v.Status = v3
|
2015-06-23 03:45:08 +00:00
|
|
|
v.Started = v4
|
|
|
|
v.Finished = v5
|
|
|
|
v.Commit = &Commit{}
|
|
|
|
v.Commit.Sha = v6
|
|
|
|
v.Commit.Ref = v7
|
|
|
|
v.Commit.Branch = v8
|
|
|
|
v.Commit.Message = v9
|
|
|
|
v.Commit.Timestamp = v10
|
|
|
|
v.Commit.Remote = v11
|
|
|
|
v.Commit.Author = &Author{}
|
|
|
|
v.Commit.Author.Login = v12
|
|
|
|
v.Commit.Author.Email = v13
|
|
|
|
v.PullRequest = &PullRequest{}
|
|
|
|
v.PullRequest.Number = v14
|
|
|
|
v.PullRequest.Title = v15
|
|
|
|
v.PullRequest.Base = &Commit{}
|
|
|
|
v.PullRequest.Base.Sha = v16
|
|
|
|
v.PullRequest.Base.Ref = v17
|
|
|
|
v.PullRequest.Base.Branch = v18
|
|
|
|
v.PullRequest.Base.Message = v19
|
|
|
|
v.PullRequest.Base.Timestamp = v20
|
|
|
|
v.PullRequest.Base.Remote = v21
|
|
|
|
v.PullRequest.Base.Author = &Author{}
|
|
|
|
v.PullRequest.Base.Author.Login = v22
|
|
|
|
v.PullRequest.Base.Author.Email = v23
|
2015-06-13 23:48:06 +00:00
|
|
|
vv = append(vv, v)
|
|
|
|
}
|
|
|
|
return vv, rows.Err()
|
|
|
|
}
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
const stmtBuildSelectList = `
|
2015-06-13 23:48:06 +00:00
|
|
|
SELECT
|
2015-06-23 03:45:08 +00:00
|
|
|
build_id
|
|
|
|
,build_repo_id
|
|
|
|
,build_number
|
|
|
|
,build_status
|
|
|
|
,build_started
|
|
|
|
,build_finished
|
|
|
|
,build_commit_sha
|
|
|
|
,build_commit_ref
|
|
|
|
,build_commit_branch
|
|
|
|
,build_commit_message
|
|
|
|
,build_commit_timestamp
|
|
|
|
,build_commit_remote
|
|
|
|
,build_commit_author_login
|
|
|
|
,build_commit_author_email
|
|
|
|
,build_pull_request_number
|
|
|
|
,build_pull_request_title
|
|
|
|
,build_pull_request_base_sha
|
|
|
|
,build_pull_request_base_ref
|
|
|
|
,build_pull_request_base_branch
|
|
|
|
,build_pull_request_base_message
|
|
|
|
,build_pull_request_base_timestamp
|
|
|
|
,build_pull_request_base_remote
|
|
|
|
,build_pull_request_base_author_login
|
|
|
|
,build_pull_request_base_author_email
|
|
|
|
FROM builds
|
2015-06-13 23:48:06 +00:00
|
|
|
`
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
const stmtBuildSelectRange = `
|
2015-06-13 23:48:06 +00:00
|
|
|
SELECT
|
2015-06-23 03:45:08 +00:00
|
|
|
build_id
|
|
|
|
,build_repo_id
|
|
|
|
,build_number
|
|
|
|
,build_status
|
|
|
|
,build_started
|
|
|
|
,build_finished
|
|
|
|
,build_commit_sha
|
|
|
|
,build_commit_ref
|
|
|
|
,build_commit_branch
|
|
|
|
,build_commit_message
|
|
|
|
,build_commit_timestamp
|
|
|
|
,build_commit_remote
|
|
|
|
,build_commit_author_login
|
|
|
|
,build_commit_author_email
|
|
|
|
,build_pull_request_number
|
|
|
|
,build_pull_request_title
|
|
|
|
,build_pull_request_base_sha
|
|
|
|
,build_pull_request_base_ref
|
|
|
|
,build_pull_request_base_branch
|
|
|
|
,build_pull_request_base_message
|
|
|
|
,build_pull_request_base_timestamp
|
|
|
|
,build_pull_request_base_remote
|
|
|
|
,build_pull_request_base_author_login
|
|
|
|
,build_pull_request_base_author_email
|
|
|
|
FROM builds
|
2015-06-13 23:48:06 +00:00
|
|
|
LIMIT ? OFFSET ?
|
|
|
|
`
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
const stmtBuildSelect = `
|
2015-06-13 23:48:06 +00:00
|
|
|
SELECT
|
2015-06-23 03:45:08 +00:00
|
|
|
build_id
|
|
|
|
,build_repo_id
|
|
|
|
,build_number
|
|
|
|
,build_status
|
|
|
|
,build_started
|
|
|
|
,build_finished
|
|
|
|
,build_commit_sha
|
|
|
|
,build_commit_ref
|
|
|
|
,build_commit_branch
|
|
|
|
,build_commit_message
|
|
|
|
,build_commit_timestamp
|
|
|
|
,build_commit_remote
|
|
|
|
,build_commit_author_login
|
|
|
|
,build_commit_author_email
|
|
|
|
,build_pull_request_number
|
|
|
|
,build_pull_request_title
|
|
|
|
,build_pull_request_base_sha
|
|
|
|
,build_pull_request_base_ref
|
|
|
|
,build_pull_request_base_branch
|
|
|
|
,build_pull_request_base_message
|
|
|
|
,build_pull_request_base_timestamp
|
|
|
|
,build_pull_request_base_remote
|
|
|
|
,build_pull_request_base_author_login
|
|
|
|
,build_pull_request_base_author_email
|
|
|
|
FROM builds
|
|
|
|
WHERE build_id = ?
|
2015-06-13 23:48:06 +00:00
|
|
|
`
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
const stmtBuildSelectBuildRepoId = `
|
2015-06-13 23:48:06 +00:00
|
|
|
SELECT
|
2015-06-23 03:45:08 +00:00
|
|
|
build_id
|
|
|
|
,build_repo_id
|
|
|
|
,build_number
|
|
|
|
,build_status
|
|
|
|
,build_started
|
|
|
|
,build_finished
|
|
|
|
,build_commit_sha
|
|
|
|
,build_commit_ref
|
|
|
|
,build_commit_branch
|
|
|
|
,build_commit_message
|
|
|
|
,build_commit_timestamp
|
|
|
|
,build_commit_remote
|
|
|
|
,build_commit_author_login
|
|
|
|
,build_commit_author_email
|
|
|
|
,build_pull_request_number
|
|
|
|
,build_pull_request_title
|
|
|
|
,build_pull_request_base_sha
|
|
|
|
,build_pull_request_base_ref
|
|
|
|
,build_pull_request_base_branch
|
|
|
|
,build_pull_request_base_message
|
|
|
|
,build_pull_request_base_timestamp
|
|
|
|
,build_pull_request_base_remote
|
|
|
|
,build_pull_request_base_author_login
|
|
|
|
,build_pull_request_base_author_email
|
|
|
|
FROM builds
|
|
|
|
WHERE build_repo_id = ?
|
2015-06-13 23:48:06 +00:00
|
|
|
`
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
const stmtBuildSelectBuildNumber = `
|
2015-06-13 23:48:06 +00:00
|
|
|
SELECT
|
2015-06-23 03:45:08 +00:00
|
|
|
build_id
|
|
|
|
,build_repo_id
|
|
|
|
,build_number
|
|
|
|
,build_status
|
|
|
|
,build_started
|
|
|
|
,build_finished
|
|
|
|
,build_commit_sha
|
|
|
|
,build_commit_ref
|
|
|
|
,build_commit_branch
|
|
|
|
,build_commit_message
|
|
|
|
,build_commit_timestamp
|
|
|
|
,build_commit_remote
|
|
|
|
,build_commit_author_login
|
|
|
|
,build_commit_author_email
|
|
|
|
,build_pull_request_number
|
|
|
|
,build_pull_request_title
|
|
|
|
,build_pull_request_base_sha
|
|
|
|
,build_pull_request_base_ref
|
|
|
|
,build_pull_request_base_branch
|
|
|
|
,build_pull_request_base_message
|
|
|
|
,build_pull_request_base_timestamp
|
|
|
|
,build_pull_request_base_remote
|
|
|
|
,build_pull_request_base_author_login
|
|
|
|
,build_pull_request_base_author_email
|
|
|
|
FROM builds
|
|
|
|
WHERE build_repo_id = ?
|
|
|
|
AND build_number = ?
|
2015-06-19 00:36:52 +00:00
|
|
|
`
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
const stmtBuildSelectCommitBranch = `
|
|
|
|
SELECT
|
|
|
|
build_id
|
|
|
|
,build_repo_id
|
|
|
|
,build_number
|
|
|
|
,build_status
|
|
|
|
,build_started
|
|
|
|
,build_finished
|
|
|
|
,build_commit_sha
|
|
|
|
,build_commit_ref
|
|
|
|
,build_commit_branch
|
|
|
|
,build_commit_message
|
|
|
|
,build_commit_timestamp
|
|
|
|
,build_commit_remote
|
|
|
|
,build_commit_author_login
|
|
|
|
,build_commit_author_email
|
|
|
|
,build_pull_request_number
|
|
|
|
,build_pull_request_title
|
|
|
|
,build_pull_request_base_sha
|
|
|
|
,build_pull_request_base_ref
|
|
|
|
,build_pull_request_base_branch
|
|
|
|
,build_pull_request_base_message
|
|
|
|
,build_pull_request_base_timestamp
|
|
|
|
,build_pull_request_base_remote
|
|
|
|
,build_pull_request_base_author_login
|
|
|
|
,build_pull_request_base_author_email
|
|
|
|
FROM builds
|
|
|
|
WHERE build_branch = ?
|
|
|
|
AND build_branch = ?
|
|
|
|
`
|
|
|
|
|
|
|
|
const stmtBuildSelectCount = `
|
2015-06-19 00:36:52 +00:00
|
|
|
SELECT count(1)
|
2015-06-23 03:45:08 +00:00
|
|
|
FROM builds
|
2015-06-13 23:48:06 +00:00
|
|
|
`
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
const stmtBuildInsert = `
|
|
|
|
INSERT INTO builds (
|
|
|
|
build_repo_id
|
|
|
|
,build_number
|
|
|
|
,build_status
|
|
|
|
,build_started
|
|
|
|
,build_finished
|
|
|
|
,build_commit_sha
|
|
|
|
,build_commit_ref
|
|
|
|
,build_commit_branch
|
|
|
|
,build_commit_message
|
|
|
|
,build_commit_timestamp
|
|
|
|
,build_commit_remote
|
|
|
|
,build_commit_author_login
|
|
|
|
,build_commit_author_email
|
|
|
|
,build_pull_request_number
|
|
|
|
,build_pull_request_title
|
|
|
|
,build_pull_request_base_sha
|
|
|
|
,build_pull_request_base_ref
|
|
|
|
,build_pull_request_base_branch
|
|
|
|
,build_pull_request_base_message
|
|
|
|
,build_pull_request_base_timestamp
|
|
|
|
,build_pull_request_base_remote
|
|
|
|
,build_pull_request_base_author_login
|
|
|
|
,build_pull_request_base_author_email
|
|
|
|
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);
|
2015-06-13 23:48:06 +00:00
|
|
|
`
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
const stmtBuildUpdate = `
|
|
|
|
UPDATE builds SET
|
|
|
|
build_repo_id = ?
|
|
|
|
,build_number = ?
|
|
|
|
,build_status = ?
|
|
|
|
,build_started = ?
|
|
|
|
,build_finished = ?
|
|
|
|
,build_commit_sha = ?
|
|
|
|
,build_commit_ref = ?
|
|
|
|
,build_commit_branch = ?
|
|
|
|
,build_commit_message = ?
|
|
|
|
,build_commit_timestamp = ?
|
|
|
|
,build_commit_remote = ?
|
|
|
|
,build_commit_author_login = ?
|
|
|
|
,build_commit_author_email = ?
|
|
|
|
,build_pull_request_number = ?
|
|
|
|
,build_pull_request_title = ?
|
|
|
|
,build_pull_request_base_sha = ?
|
|
|
|
,build_pull_request_base_ref = ?
|
|
|
|
,build_pull_request_base_branch = ?
|
|
|
|
,build_pull_request_base_message = ?
|
|
|
|
,build_pull_request_base_timestamp = ?
|
|
|
|
,build_pull_request_base_remote = ?
|
|
|
|
,build_pull_request_base_author_login = ?
|
|
|
|
,build_pull_request_base_author_email = ?
|
|
|
|
WHERE build_id = ?
|
2015-06-13 23:48:06 +00:00
|
|
|
`
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
const stmtBuildDelete = `
|
|
|
|
DELETE FROM builds
|
|
|
|
WHERE build_id = ?
|
2015-06-13 23:48:06 +00:00
|
|
|
`
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
const stmtBuildTable = `
|
|
|
|
CREATE TABLE IF NOT EXISTS builds (
|
|
|
|
build_id INTEGER PRIMARY KEY AUTOINCREMENT
|
|
|
|
,build_repo_id INTEGER
|
|
|
|
,build_number INTEGER
|
|
|
|
,build_status VARCHAR(512)
|
|
|
|
,build_started INTEGER
|
|
|
|
,build_finished INTEGER
|
|
|
|
,build_commit_sha VARCHAR(512)
|
|
|
|
,build_commit_ref VARCHAR(512)
|
|
|
|
,build_commit_branch VARCHAR(512)
|
|
|
|
,build_commit_message VARCHAR(512)
|
|
|
|
,build_commit_timestamp VARCHAR(512)
|
|
|
|
,build_commit_remote VARCHAR(512)
|
|
|
|
,build_commit_author_login VARCHAR(512)
|
|
|
|
,build_commit_author_email VARCHAR(512)
|
|
|
|
,build_pull_request_number INTEGER
|
|
|
|
,build_pull_request_title VARCHAR(512)
|
|
|
|
,build_pull_request_base_sha VARCHAR(512)
|
|
|
|
,build_pull_request_base_ref VARCHAR(512)
|
|
|
|
,build_pull_request_base_branch VARCHAR(512)
|
|
|
|
,build_pull_request_base_message VARCHAR(512)
|
|
|
|
,build_pull_request_base_timestamp VARCHAR(512)
|
|
|
|
,build_pull_request_base_remote VARCHAR(512)
|
|
|
|
,build_pull_request_base_author_login VARCHAR(512)
|
|
|
|
,build_pull_request_base_author_email VARCHAR(512)
|
2015-06-13 23:48:06 +00:00
|
|
|
);
|
|
|
|
`
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
const stmtBuildBuildRepoIdIndex = `
|
|
|
|
CREATE INDEX IF NOT EXISTS ix_build_repo_id ON builds (build_repo_id);
|
|
|
|
`
|
|
|
|
|
|
|
|
const stmtBuildBuildNumberIndex = `
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS ux_build_number ON builds (build_repo_id,build_number);
|
2015-06-13 23:48:06 +00:00
|
|
|
`
|
|
|
|
|
2015-06-23 03:45:08 +00:00
|
|
|
const stmtBuildCommitBranchIndex = `
|
|
|
|
CREATE INDEX IF NOT EXISTS ix_commit_branch ON builds (build_branch,build_branch);
|
2015-06-13 23:48:06 +00:00
|
|
|
`
|