summaryrefslogtreecommitdiff
path: root/src/sql.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql.rs')
-rw-r--r--src/sql.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/sql.rs b/src/sql.rs
index 3476643..21572da 100644
--- a/src/sql.rs
+++ b/src/sql.rs
@@ -3,10 +3,16 @@
use std::convert::TryFrom;
#[derive(Debug, Clone)]
+pub enum JobResult {
+ Pass = 0,
+ Fail = 1,
+}
+
+#[derive(Debug, Clone, PartialEq)]
pub enum JobState {
Pending = 0,
Started = 1,
- Complete = 2,
+ Finished = 2,
Error = 3,
Invalid = 4,
}
@@ -18,7 +24,7 @@ impl TryFrom<u8> for JobState {
match value {
0 => Ok(JobState::Pending),
1 => Ok(JobState::Started),
- 2 => Ok(JobState::Complete),
+ 2 => Ok(JobState::Finished),
3 => Ok(JobState::Error),
4 => Ok(JobState::Invalid),
other => Err(format!("invalid job state: {}", other)),
@@ -40,7 +46,9 @@ pub const CREATE_JOBS_TABLE: &'static str = "\
started_time INTEGER,
complete_time INTEGER,
job_timeout INTEGER,
- source TEXT);";
+ source TEXT,
+ build_result INTEGER,
+ final_status TEXT);";
pub const CREATE_COMMITS_TABLE: &'static str = "\
CREATE TABLE IF NOT EXISTS commits (id INTEGER PRIMARY KEY AUTOINCREMENT, sha TEXT UNIQUE);";
@@ -79,6 +87,9 @@ pub const CREATE_REPO_NAME_INDEX: &'static str = "\
pub const PENDING_JOBS: &'static str = "\
select id, artifacts_path, state, run_host, remote_id, commit_id, created_time, source from jobs where state=0;";
+pub const LAST_ARTIFACTS_FOR_JOB: &'static str = "\
+ select * from artifacts where job_id=?1 and (name like \"%(stderr)%\" or name like \"%(stdout)%\") order by id desc limit 2;";
+
pub const COMMIT_TO_ID: &'static str = "\
select id from commits where sha=?1;";