From d4a708ce196b08a698ed8c3d4843c8b996ba28ac Mon Sep 17 00:00:00 2001 From: Park Daesun Date: Wed, 4 May 2016 04:26:36 +0900 Subject: Fix incorrect postgres keys. (#2855) user_test.go test has errors because incorrect postgres keys. [2016/05/03 10:19:15 KST] [EROR] /api/v3/users/create:SqlUserStore.Save code=500 rid=6h5gz1fuxids9ytzimzbgwno3e uid= ip=::1 We couldn't save the account. [details: user_id=3o8aod7uapnxzmngn3rz1rm48r, pq: duplicate key value violates unique constraint "users_email_key"] --- FAIL: TestCreateUser (0.12s) user_test.go:59: : We couldn't save the account., user_id=3o8aod7uapnxzmngn3rz1rm48r, pq: duplicate key value violates unique constraint "users_email_key" [2016/05/03 10:26:06 KST] [EROR] /api/v3/users/create:SqlUserStore.Save code=500 rid=tetdakekgffzu8muhrrxuzc9ae uid= ip=::1 We couldn't save the account. [details: user_id=izifcscu5igpzb48ey1gmi5wjw, pq: duplicate key value violates unique constraint "users_username_key"] --- FAIL: TestCreateUser (0.12s) user_test.go:67: : We couldn't save the account., user_id=izifcscu5igpzb48ey1gmi5wjw, pq: duplicate key value violates unique constraint "users_username_key" --- store/sql_user_store.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'store/sql_user_store.go') diff --git a/store/sql_user_store.go b/store/sql_user_store.go index 37bc148e1..006ea734b 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -77,9 +77,9 @@ func (us SqlUserStore) Save(user *model.User) StoreChannel { } if err := us.GetMaster().Insert(user); err != nil { - if IsUniqueConstraintError(err.Error(), "Email", "users_email_teamid_key") { + if IsUniqueConstraintError(err.Error(), "Email", "users_email_key") { result.Err = model.NewLocAppError("SqlUserStore.Save", "store.sql_user.save.email_exists.app_error", nil, "user_id="+user.Id+", "+err.Error()) - } else if IsUniqueConstraintError(err.Error(), "Username", "users_username_teamid_key") { + } else if IsUniqueConstraintError(err.Error(), "Username", "users_username_key") { result.Err = model.NewLocAppError("SqlUserStore.Save", "store.sql_user.save.username_exists.app_error", nil, "user_id="+user.Id+", "+err.Error()) } else { result.Err = model.NewLocAppError("SqlUserStore.Save", "store.sql_user.save.app_error", nil, "user_id="+user.Id+", "+err.Error()) -- cgit v1.2.3-1-g7c22