We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
> 0
1 parent 3a9b31d commit d7c96b8Copy full SHA for d7c96b8
src/user/mod.rs
@@ -83,6 +83,14 @@ impl<'a> NewUser<'a> {
83
gh_access_token: self.gh_access_token.clone(),
84
};
85
86
+ // We need the `WHERE gh_id > 0` condition here because `gh_id` set
87
+ // to `-1` indicates that we were unable to find a GitHub ID for
88
+ // the associated GitHub login at the time that we backfilled
89
+ // GitHub IDs. Therefore, there are multiple records in production
90
+ // that have a `gh_id` of `-1` so we need to exclude those when
91
+ // considering uniqueness of `gh_id` values. The `> 0` condition isn't
92
+ // necessary for most fields in the database to be used as a conflict
93
+ // target :)
94
let conflict_target = sql::<Integer>("(gh_id) WHERE gh_id > 0");
95
insert(&self.on_conflict(
96
conflict_target,
0 commit comments