Skip to content

Commit

Permalink
Merge pull request #1797 from apiraino/fix-db-schema
Browse files Browse the repository at this point in the history
Fix DB schema migrations
  • Loading branch information
jackh726 authored May 10, 2024
2 parents ec76d54 + 4248caa commit fb2e814
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 fb2e814

Please sign in to comment.