File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,14 @@ impl<'a> NewUser<'a> {
83
83
gh_access_token : self . gh_access_token . clone ( ) ,
84
84
} ;
85
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 :)
86
94
let conflict_target = sql :: < Integer > ( "(gh_id) WHERE gh_id > 0" ) ;
87
95
insert ( & self . on_conflict (
88
96
conflict_target,
You can’t perform that action at this time.
0 commit comments