mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-25 01:34:02 +00:00
Merge pull request #1812 from zed-industries/fix-500-error-on-user-join
Fix duplicate key error that occurs when a user joins that is already in the db
This commit is contained in:
commit
a7d86a164c
1 changed files with 5 additions and 0 deletions
|
@ -567,6 +567,10 @@ impl Db for PostgresDb {
|
|||
(email_address, github_login, github_user_id, admin, invite_count, invite_code)
|
||||
VALUES
|
||||
($1, $2, $3, 'f', $4, $5)
|
||||
ON CONFLICT (github_login) DO UPDATE SET
|
||||
email_address = excluded.email_address,
|
||||
github_user_id = excluded.github_user_id,
|
||||
admin = excluded.admin
|
||||
RETURNING id, metrics_id::text
|
||||
",
|
||||
)
|
||||
|
@ -616,6 +620,7 @@ impl Db for PostgresDb {
|
|||
(user_id_a, user_id_b, a_to_b, should_notify, accepted)
|
||||
VALUES
|
||||
($1, $2, 't', 't', 't')
|
||||
ON CONFLICT DO NOTHING
|
||||
",
|
||||
)
|
||||
.bind(inviting_user_id)
|
||||
|
|
Loading…
Reference in a new issue