Monorepo for Tangled

appview/db: allow regenerating invite codes

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>

authored by

oppiliappan and committed by tangled.org 1d0c1d8c 3b646dcb

+1 -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 }