@@ -236,15 +236,18 @@ func genData(t *testing.T, db database.Store) []database.User {
236236OAuthAccessToken :"access-" + usr .ID .String (),
237237OAuthRefreshToken :"refresh-" + usr .ID .String (),
238238})
239- // Fun fact: our schema allows _all_ login types to have
240- // a user_link. Even though I'm not sure how it could occur
241- // in practice, making sure to test all combinations here.
242- _ = dbgen .UserLink (t ,db , database.UserLink {
243- UserID :usr .ID ,
244- LoginType :usr .LoginType ,
245- OAuthAccessToken :"access-" + usr .ID .String (),
246- OAuthRefreshToken :"refresh-" + usr .ID .String (),
247- })
239+ // Deleted users cannot have user_links
240+ if ! deleted {
241+ // Fun fact: our schema allows _all_ login types to have
242+ // a user_link. Even though I'm not sure how it could occur
243+ // in practice, making sure to test all combinations here.
244+ _ = dbgen .UserLink (t ,db , database.UserLink {
245+ UserID :usr .ID ,
246+ LoginType :usr .LoginType ,
247+ OAuthAccessToken :"access-" + usr .ID .String (),
248+ OAuthRefreshToken :"refresh-" + usr .ID .String (),
249+ })
250+ }
248251users = append (users ,usr )
249252}
250253}