Skip to content

Commit

Permalink
fix: unique constraint on nick_id
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielllllllllllllll committed Jun 27, 2024
1 parent 36a43e9 commit 0742ecc
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion migrations/2405170335_create_users_table.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ CREATE TABLE user_identity(
created_at timestamp default CURRENT_TIMESTAMP,
activated boolean default false,
refresh_token varchar(100),
device_token varchar(100)
device_token varchar(100),
nick_id VARCHAR(150) UNIQUE
);

CREATE TABLE email_login(
Expand Down
1 change: 0 additions & 1 deletion migrations/2406260601_add_nickId.down.sql

This file was deleted.

1 change: 0 additions & 1 deletion migrations/2406260601_add_nickId.up.sql

This file was deleted.

2 changes: 1 addition & 1 deletion services/api/test/friend_invite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestInviteFriend(t *testing.T) {
_, err := client.UpdateUserNickId(context.Background(), &monify.UpdateUserNickIdRequest{NickId: "test_nickId1"})
assert.NoError(t, err)
_, err = client.InviteFriend(context.TODO(), &monify.InviteFriendRequest{ReceiverNickId: "test_nickId1"})
assert.Error(t, err)
assert.Error(t, err) // cannot send invitation to yourself
_ = client.CreateTestUser()
_, err = client.InviteFriend(context.TODO(), &monify.InviteFriendRequest{ReceiverNickId: "test_nickId1"})
assert.NoError(t, err)
Expand Down

0 comments on commit 0742ecc

Please sign in to comment.