more db refactors

This commit is contained in:
2026-02-09 22:28:52 +11:00
parent fada95a7e4
commit ead70bcfc4
4 changed files with 18 additions and 22 deletions

View File

@@ -38,10 +38,7 @@ func (u *User) UpdateDiscordToken(ctx context.Context, tx bun.Tx, token *discord
}
err := Insert(tx, discordToken).
On("CONFLICT (discord_id) DO UPDATE").
Set("access_token = EXCLUDED.access_token").
Set("refresh_token = EXCLUDED.refresh_token").
Set("expires_at = EXCLUDED.expires_at").
ConflictUpdate([]string{"discord_id"}, "access_token", "refresh_token", "expires_at").
Exec(ctx)
if err != nil {
return errors.Wrap(err, "db.Insert")