diff options
author | Park Daesun <yume@yumes.net> | 2016-05-04 04:26:36 +0900 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-05-03 12:26:36 -0700 |
commit | d4a708ce196b08a698ed8c3d4843c8b996ba28ac (patch) | |
tree | 1073fe9968e211b2ba4fdde2d7072460986b9a42 | |
parent | b18cf58c8f607bed64d821fcc856e251a391df6a (diff) | |
download | chat-d4a708ce196b08a698ed8c3d4843c8b996ba28ac.tar.gz chat-d4a708ce196b08a698ed8c3d4843c8b996ba28ac.tar.bz2 chat-d4a708ce196b08a698ed8c3d4843c8b996ba28ac.zip |
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"
-rw-r--r-- | store/sql_user_store.go | 4 |
1 files changed, 2 insertions, 2 deletions
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()) |