{"action":"created","comment":{"url":"https://api.github.com/repos/sharetribe/sharetribe/pulls/comments/60717619","id":60717619,"diff_hunk":"@@ -0,0 +1,8 @@\n+class AddIndexUniqueCommunityIdAndFacebookId < ActiveRecord::Migration\n+  def change\n+    # Remove the old facebook_id from index because we don't\n+    # do searches with facebook id only","path":"db/migrate/20160422094212_add_index_unique_community_id_and_facebook_id.rb","position":4,"original_position":4,"commit_id":"5cddb0fcf22e47b9f3858d9acc4847c1323e4b65","original_commit_id":"5cddb0fcf22e47b9f3858d9acc4847c1323e4b65","user":{"login":"sktoiva","id":230815,"avatar_url":"https://avatars.githubusercontent.com/u/230815?v=3","gravatar_id":"","url":"https://api.github.com/users/sktoiva","html_url":"https://github.com/sktoiva","followers_url":"https://api.github.com/users/sktoiva/followers","following_url":"https://api.github.com/users/sktoiva/following{/other_user}","gists_url":"https://api.github.com/users/sktoiva/gists{/gist_id}","starred_url":"https://api.github.com/users/sktoiva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sktoiva/subscriptions","organizations_url":"https://api.github.com/users/sktoiva/orgs","repos_url":"https://api.github.com/users/sktoiva/repos","events_url":"https://api.github.com/users/sktoiva/events{/privacy}","received_events_url":"https://api.github.com/users/sktoiva/received_events","type":"User","site_admin":false},"body":"Yes we do, in sessions_controller:\r\n\r\n```ruby\r\n  persons = Person\r\n              .includes(:emails, :community_memberships)\r\n              .references(:emails)\r\n              .where([\"people.facebook_id = ? OR emails.address = ?\", data.id, data.email]).uniq\r\n```","created_at":"2016-04-22T10:07:05Z","updated_at":"2016-04-22T10:07:05Z","html_url":"https://github.com/sharetribe/sharetribe/pull/1943#discussion_r60717619","pull_request_url":"https://api.github.com/repos/sharetribe/sharetribe/pulls/1943","_links":{"self":{"href":"https://api.github.com/repos/sharetribe/sharetribe/pulls/comments/60717619"},"html":{"href":"https://github.com/sharetribe/sharetribe/pull/1943#discussion_r60717619"},"pull_request":{"href":"https://api.github.com/repos/sharetribe/sharetribe/pulls/1943"}}},"pull_request":{"url":"https://api.github.com/repos/sharetribe/sharetribe/pulls/1943","id":67486816,"html_url":"https://github.com/sharetribe/sharetribe/pull/1943","diff_url":"https://github.com/sharetribe/sharetribe/pull/1943.diff","patch_url":"https://github.com/sharetribe/sharetribe/pull/1943.patch","issue_url":"https://api.github.com/repos/sharetribe/sharetribe/issues/1943","number":1943,"state":"open","locked":false,"title":"Add proper indices","user":{"login":"rap1ds","id":429876,"avatar_url":"https://avatars.githubusercontent.com/u/429876?v=3","gravatar_id":"","url":"https://api.github.com/users/rap1ds","html_url":"https://github.com/rap1ds","followers_url":"https://api.github.com/users/rap1ds/followers","following_url":"https://api.github.com/users/rap1ds/following{/other_user}","gists_url":"https://api.github.com/users/rap1ds/gists{/gist_id}","starred_url":"https://api.github.com/users/rap1ds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rap1ds/subscriptions","organizations_url":"https://api.github.com/users/rap1ds/orgs","repos_url":"https://api.github.com/users/rap1ds/repos","events_url":"https://api.github.com/users/rap1ds/events{/privacy}","received_events_url":"https://api.github.com/users/rap1ds/received_events","type":"User","site_admin":false},"body":"- [X] `people.username` NOT NULL\r\n- [X] `emails.address` NOT NULL\r\n- [X] Unique `people.facebook_id`, `people.community_id` pair\r\n- [X] Unique `emails.address`, `emails.community_id` pair\r\n- [X] Unique `people.username`, `people.community_id` pair\r\n\r\nIn the next PR (needs still some work):\r\n\r\n- [ ] Set `people.community_id` NOT NULL\r\n- [ ] Set `emails.community_id` NOT NULL","created_at":"2016-04-22T09:56:46Z","updated_at":"2016-04-22T10:07:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"94cd4ebcf0922f2ec978a2386291b4d2c9351da8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sharetribe/sharetribe/pulls/1943/commits","review_comments_url":"https://api.github.com/repos/sharetribe/sharetribe/pulls/1943/comments","review_comment_url":"https://api.github.com/repos/sharetribe/sharetribe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sharetribe/sharetribe/issues/1943/comments","statuses_url":"https://api.github.com/repos/sharetribe/sharetribe/statuses/5cddb0fcf22e47b9f3858d9acc4847c1323e4b65","head":{"label":"sharetribe:add-proper-indices","ref":"add-proper-indices","sha":"5cddb0fcf22e47b9f3858d9acc4847c1323e4b65","user":{"login":"sharetribe","id":1733898,"avatar_url":"https://avatars.githubusercontent.com/u/1733898?v=3","gravatar_id":"","url":"https://api.github.com/users/sharetribe","html_url":"https://github.com/sharetribe","followers_url":"https://api.github.com/users/sharetribe/followers","following_url":"https://api.github.com/users/sharetribe/following{/other_user}","gists_url":"https://api.github.com/users/sharetribe/gists{/gist_id}","starred_url":"https://api.github.com/users/sharetribe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharetribe/subscriptions","organizations_url":"https://api.github.com/users/sharetribe/orgs","repos_url":"https://api.github.com/users/sharetribe/repos","events_url":"https://api.github.com/users/sharetribe/events{/privacy}","received_events_url":"https://api.github.com/users/sharetribe/received_events","type":"Organization","site_admin":false},"repo":{"id":4447023,"name":"sharetribe","full_name":"sharetribe/sharetribe","owner":{"login":"sharetribe","id":1733898,"avatar_url":"https://avatars.githubusercontent.com/u/1733898?v=3","gravatar_id":"","url":"https://api.github.com/users/sharetribe","html_url":"https://github.com/sharetribe","followers_url":"https://api.github.com/users/sharetribe/followers","following_url":"https://api.github.com/users/sharetribe/following{/other_user}","gists_url":"https://api.github.com/users/sharetribe/gists{/gist_id}","starred_url":"https://api.github.com/users/sharetribe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharetribe/subscriptions","organizations_url":"https://api.github.com/users/sharetribe/orgs","repos_url":"https://api.github.com/users/sharetribe/repos","events_url":"https://api.github.com/users/sharetribe/events{/privacy}","received_events_url":"https://api.github.com/users/sharetribe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sharetribe/sharetribe","description":"Open source marketplace platform","fork":false,"url":"https://api.github.com/repos/sharetribe/sharetribe","forks_url":"https://api.github.com/repos/sharetribe/sharetribe/forks","keys_url":"https://api.github.com/repos/sharetribe/sharetribe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sharetribe/sharetribe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sharetribe/sharetribe/teams","hooks_url":"https://api.github.com/repos/sharetribe/sharetribe/hooks","issue_events_url":"https://api.github.com/repos/sharetribe/sharetribe/issues/events{/number}","events_url":"https://api.github.com/repos/sharetribe/sharetribe/events","assignees_url":"https://api.github.com/repos/sharetribe/sharetribe/assignees{/user}","branches_url":"https://api.github.com/repos/sharetribe/sharetribe/branches{/branch}","tags_url":"https://api.github.com/repos/sharetribe/sharetribe/tags","blobs_url":"https://api.github.com/repos/sharetribe/sharetribe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sharetribe/sharetribe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sharetribe/sharetribe/git/refs{/sha}","trees_url":"https://api.github.com/repos/sharetribe/sharetribe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sharetribe/sharetribe/statuses/{sha}","languages_url":"https://api.github.com/repos/sharetribe/sharetribe/languages","stargazers_url":"https://api.github.com/repos/sharetribe/sharetribe/stargazers","contributors_url":"https://api.github.com/repos/sharetribe/sharetribe/contributors","subscribers_url":"https://api.github.com/repos/sharetribe/sharetribe/subscribers","subscription_url":"https://api.github.com/repos/sharetribe/sharetribe/subscription","commits_url":"https://api.github.com/repos/sharetribe/sharetribe/commits{/sha}","git_commits_url":"https://api.github.com/repos/sharetribe/sharetribe/git/commits{/sha}","comments_url":"https://api.github.com/repos/sharetribe/sharetribe/comments{/number}","issue_comment_url":"https://api.github.com/repos/sharetribe/sharetribe/issues/comments{/number}","contents_url":"https://api.github.com/repos/sharetribe/sharetribe/contents/{+path}","compare_url":"https://api.github.com/repos/sharetribe/sharetribe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sharetribe/sharetribe/merges","archive_url":"https://api.github.com/repos/sharetribe/sharetribe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sharetribe/sharetribe/downloads","issues_url":"https://api.github.com/repos/sharetribe/sharetribe/issues{/number}","pulls_url":"https://api.github.com/repos/sharetribe/sharetribe/pulls{/number}","milestones_url":"https://api.github.com/repos/sharetribe/sharetribe/milestones{/number}","notifications_url":"https://api.github.com/repos/sharetribe/sharetribe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sharetribe/sharetribe/labels{/name}","releases_url":"https://api.github.com/repos/sharetribe/sharetribe/releases{/id}","deployments_url":"https://api.github.com/repos/sharetribe/sharetribe/deployments","created_at":"2012-05-25T15:34:17Z","updated_at":"2016-04-20T07:39:42Z","pushed_at":"2016-04-22T09:56:47Z","git_url":"git://github.com/sharetribe/sharetribe.git","ssh_url":"git@github.com:sharetribe/sharetribe.git","clone_url":"https://github.com/sharetribe/sharetribe.git","svn_url":"https://github.com/sharetribe/sharetribe","homepage":"https://www.sharetribe.com","size":99424,"stargazers_count":606,"watchers_count":606,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":430,"mirror_url":null,"open_issues_count":16,"forks":430,"open_issues":16,"watchers":606,"default_branch":"master"}},"base":{"label":"sharetribe:master","ref":"master","sha":"1bfd4d70e27dbe8b2f0b0703955928f5b29e3a7a","user":{"login":"sharetribe","id":1733898,"avatar_url":"https://avatars.githubusercontent.com/u/1733898?v=3","gravatar_id":"","url":"https://api.github.com/users/sharetribe","html_url":"https://github.com/sharetribe","followers_url":"https://api.github.com/users/sharetribe/followers","following_url":"https://api.github.com/users/sharetribe/following{/other_user}","gists_url":"https://api.github.com/users/sharetribe/gists{/gist_id}","starred_url":"https://api.github.com/users/sharetribe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharetribe/subscriptions","organizations_url":"https://api.github.com/users/sharetribe/orgs","repos_url":"https://api.github.com/users/sharetribe/repos","events_url":"https://api.github.com/users/sharetribe/events{/privacy}","received_events_url":"https://api.github.com/users/sharetribe/received_events","type":"Organization","site_admin":false},"repo":{"id":4447023,"name":"sharetribe","full_name":"sharetribe/sharetribe","owner":{"login":"sharetribe","id":1733898,"avatar_url":"https://avatars.githubusercontent.com/u/1733898?v=3","gravatar_id":"","url":"https://api.github.com/users/sharetribe","html_url":"https://github.com/sharetribe","followers_url":"https://api.github.com/users/sharetribe/followers","following_url":"https://api.github.com/users/sharetribe/following{/other_user}","gists_url":"https://api.github.com/users/sharetribe/gists{/gist_id}","starred_url":"https://api.github.com/users/sharetribe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharetribe/subscriptions","organizations_url":"https://api.github.com/users/sharetribe/orgs","repos_url":"https://api.github.com/users/sharetribe/repos","events_url":"https://api.github.com/users/sharetribe/events{/privacy}","received_events_url":"https://api.github.com/users/sharetribe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sharetribe/sharetribe","description":"Open source marketplace platform","fork":false,"url":"https://api.github.com/repos/sharetribe/sharetribe","forks_url":"https://api.github.com/repos/sharetribe/sharetribe/forks","keys_url":"https://api.github.com/repos/sharetribe/sharetribe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sharetribe/sharetribe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sharetribe/sharetribe/teams","hooks_url":"https://api.github.com/repos/sharetribe/sharetribe/hooks","issue_events_url":"https://api.github.com/repos/sharetribe/sharetribe/issues/events{/number}","events_url":"https://api.github.com/repos/sharetribe/sharetribe/events","assignees_url":"https://api.github.com/repos/sharetribe/sharetribe/assignees{/user}","branches_url":"https://api.github.com/repos/sharetribe/sharetribe/branches{/branch}","tags_url":"https://api.github.com/repos/sharetribe/sharetribe/tags","blobs_url":"https://api.github.com/repos/sharetribe/sharetribe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sharetribe/sharetribe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sharetribe/sharetribe/git/refs{/sha}","trees_url":"https://api.github.com/repos/sharetribe/sharetribe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sharetribe/sharetribe/statuses/{sha}","languages_url":"https://api.github.com/repos/sharetribe/sharetribe/languages","stargazers_url":"https://api.github.com/repos/sharetribe/sharetribe/stargazers","contributors_url":"https://api.github.com/repos/sharetribe/sharetribe/contributors","subscribers_url":"https://api.github.com/repos/sharetribe/sharetribe/subscribers","subscription_url":"https://api.github.com/repos/sharetribe/sharetribe/subscription","commits_url":"https://api.github.com/repos/sharetribe/sharetribe/commits{/sha}","git_commits_url":"https://api.github.com/repos/sharetribe/sharetribe/git/commits{/sha}","comments_url":"https://api.github.com/repos/sharetribe/sharetribe/comments{/number}","issue_comment_url":"https://api.github.com/repos/sharetribe/sharetribe/issues/comments{/number}","contents_url":"https://api.github.com/repos/sharetribe/sharetribe/contents/{+path}","compare_url":"https://api.github.com/repos/sharetribe/sharetribe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sharetribe/sharetribe/merges","archive_url":"https://api.github.com/repos/sharetribe/sharetribe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sharetribe/sharetribe/downloads","issues_url":"https://api.github.com/repos/sharetribe/sharetribe/issues{/number}","pulls_url":"https://api.github.com/repos/sharetribe/sharetribe/pulls{/number}","milestones_url":"https://api.github.com/repos/sharetribe/sharetribe/milestones{/number}","notifications_url":"https://api.github.com/repos/sharetribe/sharetribe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sharetribe/sharetribe/labels{/name}","releases_url":"https://api.github.com/repos/sharetribe/sharetribe/releases{/id}","deployments_url":"https://api.github.com/repos/sharetribe/sharetribe/deployments","created_at":"2012-05-25T15:34:17Z","updated_at":"2016-04-20T07:39:42Z","pushed_at":"2016-04-22T09:56:47Z","git_url":"git://github.com/sharetribe/sharetribe.git","ssh_url":"git@github.com:sharetribe/sharetribe.git","clone_url":"https://github.com/sharetribe/sharetribe.git","svn_url":"https://github.com/sharetribe/sharetribe","homepage":"https://www.sharetribe.com","size":99424,"stargazers_count":606,"watchers_count":606,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":430,"mirror_url":null,"open_issues_count":16,"forks":430,"open_issues":16,"watchers":606,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sharetribe/sharetribe/pulls/1943"},"html":{"href":"https://github.com/sharetribe/sharetribe/pull/1943"},"issue":{"href":"https://api.github.com/repos/sharetribe/sharetribe/issues/1943"},"comments":{"href":"https://api.github.com/repos/sharetribe/sharetribe/issues/1943/comments"},"review_comments":{"href":"https://api.github.com/repos/sharetribe/sharetribe/pulls/1943/comments"},"review_comment":{"href":"https://api.github.com/repos/sharetribe/sharetribe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sharetribe/sharetribe/pulls/1943/commits"},"statuses":{"href":"https://api.github.com/repos/sharetribe/sharetribe/statuses/5cddb0fcf22e47b9f3858d9acc4847c1323e4b65"}}}}