Monorepo for Tangled tangled.org

appview/db: allow regenerating invite codes #1082

merged opened by oppi.li targeting master from op/ywnzrwuowqkz

users sometimes want to regenerate invite codes, but signups_inflight never replaces the old value, since the email column has a unique constraint. by using or replace, we can update the invite code.

this keeps the db in sync with whatever the user sees in their inbox.

Signed-off-by: oppiliappan me@oppi.li

Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:qfpnj4og54vl56wngdriaxug/sh.tangled.repo.pull/3mf4g4iypfb22
+1 -1
Diff #1
+1 -1
appview/db/signup.go
··· 5 5 ) 6 6 7 7 func AddInflightSignup(e Execer, signup models.InflightSignup) error { 8 - query := `insert into signups_inflight (email, invite_code) values (?, ?)` 8 + query := `insert or replace into signups_inflight (email, invite_code) values (?, ?)` 9 9 _, err := e.Exec(query, signup.Email, signup.InviteCode) 10 10 return err 11 11 }

History

2 rounds 1 comment
sign up or login to add to the discussion
1 commit
expand
appview/db: allow regenerating invite codes
3/3 success
expand
expand 1 comment
pull request successfully merged
oppi.li submitted #0
1 commit
expand
appview/db: allow regenerating invite codes
1/3 failed, 2/3 success
expand
expand 0 comments