Skip to content

Commit 4248caa

Browse files
committed
Fix DB schema migrations
- Fix a wrong migration introduced in #1781 - Clarify how DB migrations should be added to the triagebot
1 parent 5b0aa6e commit 4248caa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/db.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ async fn handle_job(
272272
Ok(())
273273
}
274274

275+
// Important notes when adding migrations:
276+
// - Each DB change is an element in this array and must be a single SQL instruction
277+
// - The total # of items in this array must be equal to the value of `database_versions.migration_counter`
275278
static MIGRATIONS: &[&str] = &[
276279
"
277280
CREATE TABLE notifications (
@@ -332,7 +335,8 @@ CREATE table review_prefs (
332335
assigned_prs INT[] NOT NULL DEFAULT array[]::INT[]
333336
);",
334337
"
335-
CREATE EXTENSION intarray;
336-
CREATE UNIQUE INDEX review_prefs_user_id ON review_prefs(user_id);
338+
CREATE EXTENSION IF NOT EXISTS intarray;",
339+
"
340+
CREATE UNIQUE INDEX IF NOT EXISTS review_prefs_user_id ON review_prefs(user_id);
337341
",
338342
];

0 commit comments

Comments
 (0)