Skip to content

Commit 76148d7

Browse files
tgnottinghamMark-Simulacrum
authored andcommitted
Rename SQLite pull_request_builds to match Postgres pull_request_build
1 parent 2aab119 commit 76148d7

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

database/schema.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ series aid cid value
128128

129129
**TODO**
130130

131-
### pull_request_builds
131+
### pull_request_build
132132

133133
**TODO**
134134

@@ -164,4 +164,4 @@ aid step start end
164164

165165
### error
166166

167-
**TODO**
167+
**TODO**

database/src/pool/sqlite.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ static MIGRATIONS: &[&str] = &[
162162
PRIMARY KEY(aid, cid, crate)
163163
);
164164
"#,
165+
r#"alter table pull_request_builds rename to pull_request_build"#,
165166
];
166167

167168
#[async_trait::async_trait]
@@ -470,7 +471,7 @@ impl Connection for SqliteConnection {
470471
) {
471472
self.raw_ref()
472473
.prepare_cached(
473-
"insert into pull_request_builds (pr, complete, requested, include, exclude, runs) VALUES (?, 0, strftime('%s','now'), ?, ?, ?)",
474+
"insert into pull_request_build (pr, complete, requested, include, exclude, runs) VALUES (?, 0, strftime('%s','now'), ?, ?, ?)",
474475
)
475476
.unwrap()
476477
.execute(params![pr, include, exclude, &runs])
@@ -479,7 +480,7 @@ impl Connection for SqliteConnection {
479480
async fn pr_attach_commit(&self, pr: u32, sha: &str, parent_sha: &str) -> bool {
480481
self.raw_ref()
481482
.prepare_cached(
482-
"update pull_request_builds SET bors_sha = ?, parent_sha = ?
483+
"update pull_request_build SET bors_sha = ?, parent_sha = ?
483484
where pr = ? and bors_sha is null",
484485
)
485486
.unwrap()
@@ -490,7 +491,7 @@ impl Connection for SqliteConnection {
490491
async fn queued_commits(&self) -> Vec<QueuedCommit> {
491492
self.raw_ref()
492493
.prepare_cached(
493-
"select pr, bors_sha, parent_sha, include, exclude, runs from pull_request_builds
494+
"select pr, bors_sha, parent_sha, include, exclude, runs from pull_request_build
494495
where complete is false and bors_sha is not null
495496
order by requested asc",
496497
)
@@ -514,7 +515,7 @@ impl Connection for SqliteConnection {
514515
let count = self
515516
.raw_ref()
516517
.execute(
517-
"update pull_request_builds SET complete = 1 where sha = ? and complete = 0",
518+
"update pull_request_build SET complete = 1 where sha = ? and complete = 0",
518519
params![sha],
519520
)
520521
.unwrap();
@@ -524,7 +525,7 @@ impl Connection for SqliteConnection {
524525
assert_eq!(count, 1, "sha is unique column");
525526
self.raw_ref()
526527
.query_row(
527-
"select pr, sha, parent_sha, include, exclude, runs from pull_request_builds
528+
"select pr, sha, parent_sha, include, exclude, runs from pull_request_build
528529
where sha = ?",
529530
params![sha],
530531
|row| {
@@ -867,7 +868,7 @@ impl Connection for SqliteConnection {
867868
async fn parent_of(&self, sha: &str) -> Option<String> {
868869
let mut shas = self
869870
.raw_ref()
870-
.prepare_cached("select parent_sha from pull_request_builds where bors_sha = ?")
871+
.prepare_cached("select parent_sha from pull_request_build where bors_sha = ?")
871872
.unwrap()
872873
.query(params![sha])
873874
.unwrap()
@@ -880,7 +881,7 @@ impl Connection for SqliteConnection {
880881
async fn pr_of(&self, sha: &str) -> Option<u32> {
881882
self.raw_ref()
882883
.query_row(
883-
"select pr from pull_request_builds where bors_sha = ?",
884+
"select pr from pull_request_build where bors_sha = ?",
884885
params![sha],
885886
|row| Ok(row.get(0).unwrap()),
886887
)

0 commit comments

Comments
 (0)