Skip to content

Commit d9842f5

Browse files
committedJan 22, 2023
fix sql
1 parent c9ec325 commit d9842f5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎handler.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"io"
88
"net/http"
99

10+
"entgo.io/ent/dialect/sql"
1011
"github.com/google/go-github/v49/github"
1112
"github.com/kataras/go-sessions/v3"
1213
"github.com/labstack/echo/v4"
@@ -138,7 +139,7 @@ func (h PRHandle) afterOauth(ctx context.Context, s *sessions.Session) error {
138139
}
139140

140141
err := h.ent.User.Create().SetGithubID(githubId).SetBangumiID(bangumiId).
141-
OnConflict().UpdateBangumiID().Exec(ctx)
142+
OnConflict(sql.ConflictColumns(user.FieldGithubID)).UpdateBangumiID().Exec(ctx)
142143
if err != nil {
143144
logger.Err(err).Msg("failed to save authorized user to db")
144145
return err

0 commit comments

Comments
 (0)
Please sign in to comment.