Skip to content

Commit

Permalink
Fix DB schema migrations
Browse files Browse the repository at this point in the history
- Fix a wrong migration introduced in rust-lang#1781
- Clarify how DB migrations should be added to the triagebot
  • Loading branch information
apiraino committed Apr 19, 2024
1 parent 5b0aa6e commit 4248caa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ async fn handle_job(
Ok(())
}

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

0 comments on commit 4248caa

Please sign in to comment.