{"action":"created","comment":{"url":"https://api.github.com/repos/fsek/web/pulls/comments/29131635","id":29131635,"diff_hunk":"@@ -0,0 +1,96 @@\n+class MergeProfileIntoUser < ActiveRecord::Migration\n+  def change\n+    # Update relation with posts\n+    rename_table :posts_profiles, :posts_users\n+    rename_column :posts_users, :profile_id, :user_id\n+    ActiveRecord::Base.connection.execute <<-eof\n+      update posts_users pu\n+      join profiles p on pu.user_id = p.id\n+      set pu.user_id = p.user_id\n+    eof\n+\n+    # Update relation with cafe_works\n+    rename_column :cafe_works, :profile_id, :user_id\n+    ActiveRecord::Base.connection.execute <<-eof\n+      update cafe_works cw\n+      join profiles p on cw.user_id = p.id\n+      set cw.user_id = p.user_id\n+    eof\n+\n+    # Update relation with rents\n+    rename_column :rents, :profile_id, :user_id\n+    ActiveRecord::Base.connection.execute <<-eof\n+      update rents r\n+      join profiles p on r.user_id = p.id\n+      set r.user_id = p.user_id\n+    eof\n+\n+    # Update relation with candidates\n+    rename_column :candidates, :profile_id, :user_id\n+    ActiveRecord::Base.connection.execute <<-eof\n+      update candidates c\n+      join profiles p on c.user_id = p.id\n+      set c.user_id = p.user_id\n+    eof\n+\n+    # Update relation with documents\n+    rename_column :documents, :profile_id, :user_id\n+    ActiveRecord::Base.connection.execute <<-eof\n+      update documents d\n+      join profiles p on d.user_id = p.id\n+      set d.user_id = p.user_id\n+    eof\n+\n+    # Update relation with email_accounts\n+    rename_column :email_accounts, :profile_id, :user_id\n+    ActiveRecord::Base.connection.execute <<-eof\n+      update email_accounts ea\n+      join profiles p on ea.user_id = p.id\n+      set ea.user_id = p.user_id\n+    eof\n+\n+    # Update relation with news\n+    rename_column :news, :profile_id, :user_id\n+    ActiveRecord::Base.connection.execute <<-eof\n+      update news n\n+      join profiles p on n.user_id = p.id\n+      set n.user_id = p.user_id\n+    eof\n+\n+    # Extend users with columns from profile\n+    change_table :users do |t|\n+      t.string   'firstname',           limit: 255\n+#       t.string   'program',             limit: 255\n+      t.integer  'start_year'\n+      t.string   'avatar_file_name',    limit: 255\n+      t.string   'avatar_content_type', limit: 255\n+      t.integer  'avatar_file_size'\n+      t.datetime 'avatar_updated_at'\n+      t.integer  'first_post'\n+#       t.string   'email',               limit: 255","path":"db/migrate/20410822171446_merge_profile_into_user.rb","position":70,"original_position":70,"commit_id":"88234c3861e4d381462f5512c0158c8e71297508","original_commit_id":"88234c3861e4d381462f5512c0158c8e71297508","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Incorrect indentation detected (column 0 instead of 6).","created_at":"2015-04-27T09:20:49Z","updated_at":"2015-04-27T09:20:49Z","html_url":"https://github.com/fsek/web/pull/172#discussion_r29131635","pull_request_url":"https://api.github.com/repos/fsek/web/pulls/172","_links":{"self":{"href":"https://api.github.com/repos/fsek/web/pulls/comments/29131635"},"html":{"href":"https://github.com/fsek/web/pull/172#discussion_r29131635"},"pull_request":{"href":"https://api.github.com/repos/fsek/web/pulls/172"}}},"pull_request":{"url":"https://api.github.com/repos/fsek/web/pulls/172","id":34150298,"html_url":"https://github.com/fsek/web/pull/172","diff_url":"https://github.com/fsek/web/pull/172.diff","patch_url":"https://github.com/fsek/web/pull/172.patch","issue_url":"https://api.github.com/repos/fsek/web/issues/172","number":172,"state":"open","locked":false,"title":"Add profile fields to User model","user":{"login":"henrikssn","id":859779,"avatar_url":"https://avatars.githubusercontent.com/u/859779?v=3","gravatar_id":"","url":"https://api.github.com/users/henrikssn","html_url":"https://github.com/henrikssn","followers_url":"https://api.github.com/users/henrikssn/followers","following_url":"https://api.github.com/users/henrikssn/following{/other_user}","gists_url":"https://api.github.com/users/henrikssn/gists{/gist_id}","starred_url":"https://api.github.com/users/henrikssn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/henrikssn/subscriptions","organizations_url":"https://api.github.com/users/henrikssn/orgs","repos_url":"https://api.github.com/users/henrikssn/repos","events_url":"https://api.github.com/users/henrikssn/events{/privacy}","received_events_url":"https://api.github.com/users/henrikssn/received_events","type":"User","site_admin":false},"body":"This is a reversible migration which\r\n\r\n1. Adds user_id to all models currently using profile_id\r\n2. Sets the user_id field based on a join on the profile_id field\r\n3. Adds profile fields to the user model\r\n4. Sets the profile fields based on how the Profile model looks like\r\n\r\nGood thing: This does not break anything. We can merge it asap.\r\n\r\nWe need to re-run the data migration again later as there may be some additions of data between the PRs.\r\n\r\nI will take responsibility for changing PR #109 is compatible.","created_at":"2015-04-27T08:59:40Z","updated_at":"2015-04-27T09:20:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5e26d4453ed986fdfba0947028cba3fd33c4d945","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fsek/web/pulls/172/commits","review_comments_url":"https://api.github.com/repos/fsek/web/pulls/172/comments","review_comment_url":"https://api.github.com/repos/fsek/web/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fsek/web/issues/172/comments","statuses_url":"https://api.github.com/repos/fsek/web/statuses/88234c3861e4d381462f5512c0158c8e71297508","head":{"label":"fsek:users-add-profile","ref":"users-add-profile","sha":"88234c3861e4d381462f5512c0158c8e71297508","user":{"login":"fsek","id":10084654,"avatar_url":"https://avatars.githubusercontent.com/u/10084654?v=3","gravatar_id":"","url":"https://api.github.com/users/fsek","html_url":"https://github.com/fsek","followers_url":"https://api.github.com/users/fsek/followers","following_url":"https://api.github.com/users/fsek/following{/other_user}","gists_url":"https://api.github.com/users/fsek/gists{/gist_id}","starred_url":"https://api.github.com/users/fsek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsek/subscriptions","organizations_url":"https://api.github.com/users/fsek/orgs","repos_url":"https://api.github.com/users/fsek/repos","events_url":"https://api.github.com/users/fsek/events{/privacy}","received_events_url":"https://api.github.com/users/fsek/received_events","type":"Organization","site_admin":false},"repo":{"id":27583674,"name":"web","full_name":"fsek/web","owner":{"login":"fsek","id":10084654,"avatar_url":"https://avatars.githubusercontent.com/u/10084654?v=3","gravatar_id":"","url":"https://api.github.com/users/fsek","html_url":"https://github.com/fsek","followers_url":"https://api.github.com/users/fsek/followers","following_url":"https://api.github.com/users/fsek/following{/other_user}","gists_url":"https://api.github.com/users/fsek/gists{/gist_id}","starred_url":"https://api.github.com/users/fsek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsek/subscriptions","organizations_url":"https://api.github.com/users/fsek/orgs","repos_url":"https://api.github.com/users/fsek/repos","events_url":"https://api.github.com/users/fsek/events{/privacy}","received_events_url":"https://api.github.com/users/fsek/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fsek/web","description":"F-sektionens hemsida","fork":false,"url":"https://api.github.com/repos/fsek/web","forks_url":"https://api.github.com/repos/fsek/web/forks","keys_url":"https://api.github.com/repos/fsek/web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fsek/web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fsek/web/teams","hooks_url":"https://api.github.com/repos/fsek/web/hooks","issue_events_url":"https://api.github.com/repos/fsek/web/issues/events{/number}","events_url":"https://api.github.com/repos/fsek/web/events","assignees_url":"https://api.github.com/repos/fsek/web/assignees{/user}","branches_url":"https://api.github.com/repos/fsek/web/branches{/branch}","tags_url":"https://api.github.com/repos/fsek/web/tags","blobs_url":"https://api.github.com/repos/fsek/web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fsek/web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fsek/web/git/refs{/sha}","trees_url":"https://api.github.com/repos/fsek/web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fsek/web/statuses/{sha}","languages_url":"https://api.github.com/repos/fsek/web/languages","stargazers_url":"https://api.github.com/repos/fsek/web/stargazers","contributors_url":"https://api.github.com/repos/fsek/web/contributors","subscribers_url":"https://api.github.com/repos/fsek/web/subscribers","subscription_url":"https://api.github.com/repos/fsek/web/subscription","commits_url":"https://api.github.com/repos/fsek/web/commits{/sha}","git_commits_url":"https://api.github.com/repos/fsek/web/git/commits{/sha}","comments_url":"https://api.github.com/repos/fsek/web/comments{/number}","issue_comment_url":"https://api.github.com/repos/fsek/web/issues/comments{/number}","contents_url":"https://api.github.com/repos/fsek/web/contents/{+path}","compare_url":"https://api.github.com/repos/fsek/web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fsek/web/merges","archive_url":"https://api.github.com/repos/fsek/web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fsek/web/downloads","issues_url":"https://api.github.com/repos/fsek/web/issues{/number}","pulls_url":"https://api.github.com/repos/fsek/web/pulls{/number}","milestones_url":"https://api.github.com/repos/fsek/web/milestones{/number}","notifications_url":"https://api.github.com/repos/fsek/web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fsek/web/labels{/name}","releases_url":"https://api.github.com/repos/fsek/web/releases{/id}","created_at":"2014-12-05T09:13:19Z","updated_at":"2015-04-25T07:33:08Z","pushed_at":"2015-04-27T09:20:47Z","git_url":"git://github.com/fsek/web.git","ssh_url":"git@github.com:fsek/web.git","clone_url":"https://github.com/fsek/web.git","svn_url":"https://github.com/fsek/web","homepage":"http://fsektionen.se","size":212120,"stargazers_count":4,"watchers_count":4,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":58,"forks":1,"open_issues":58,"watchers":4,"default_branch":"master"}},"base":{"label":"fsek:master","ref":"master","sha":"699d7174360268a9fd59e6c5e822da01cde30e0e","user":{"login":"fsek","id":10084654,"avatar_url":"https://avatars.githubusercontent.com/u/10084654?v=3","gravatar_id":"","url":"https://api.github.com/users/fsek","html_url":"https://github.com/fsek","followers_url":"https://api.github.com/users/fsek/followers","following_url":"https://api.github.com/users/fsek/following{/other_user}","gists_url":"https://api.github.com/users/fsek/gists{/gist_id}","starred_url":"https://api.github.com/users/fsek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsek/subscriptions","organizations_url":"https://api.github.com/users/fsek/orgs","repos_url":"https://api.github.com/users/fsek/repos","events_url":"https://api.github.com/users/fsek/events{/privacy}","received_events_url":"https://api.github.com/users/fsek/received_events","type":"Organization","site_admin":false},"repo":{"id":27583674,"name":"web","full_name":"fsek/web","owner":{"login":"fsek","id":10084654,"avatar_url":"https://avatars.githubusercontent.com/u/10084654?v=3","gravatar_id":"","url":"https://api.github.com/users/fsek","html_url":"https://github.com/fsek","followers_url":"https://api.github.com/users/fsek/followers","following_url":"https://api.github.com/users/fsek/following{/other_user}","gists_url":"https://api.github.com/users/fsek/gists{/gist_id}","starred_url":"https://api.github.com/users/fsek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fsek/subscriptions","organizations_url":"https://api.github.com/users/fsek/orgs","repos_url":"https://api.github.com/users/fsek/repos","events_url":"https://api.github.com/users/fsek/events{/privacy}","received_events_url":"https://api.github.com/users/fsek/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fsek/web","description":"F-sektionens hemsida","fork":false,"url":"https://api.github.com/repos/fsek/web","forks_url":"https://api.github.com/repos/fsek/web/forks","keys_url":"https://api.github.com/repos/fsek/web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fsek/web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fsek/web/teams","hooks_url":"https://api.github.com/repos/fsek/web/hooks","issue_events_url":"https://api.github.com/repos/fsek/web/issues/events{/number}","events_url":"https://api.github.com/repos/fsek/web/events","assignees_url":"https://api.github.com/repos/fsek/web/assignees{/user}","branches_url":"https://api.github.com/repos/fsek/web/branches{/branch}","tags_url":"https://api.github.com/repos/fsek/web/tags","blobs_url":"https://api.github.com/repos/fsek/web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fsek/web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fsek/web/git/refs{/sha}","trees_url":"https://api.github.com/repos/fsek/web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fsek/web/statuses/{sha}","languages_url":"https://api.github.com/repos/fsek/web/languages","stargazers_url":"https://api.github.com/repos/fsek/web/stargazers","contributors_url":"https://api.github.com/repos/fsek/web/contributors","subscribers_url":"https://api.github.com/repos/fsek/web/subscribers","subscription_url":"https://api.github.com/repos/fsek/web/subscription","commits_url":"https://api.github.com/repos/fsek/web/commits{/sha}","git_commits_url":"https://api.github.com/repos/fsek/web/git/commits{/sha}","comments_url":"https://api.github.com/repos/fsek/web/comments{/number}","issue_comment_url":"https://api.github.com/repos/fsek/web/issues/comments{/number}","contents_url":"https://api.github.com/repos/fsek/web/contents/{+path}","compare_url":"https://api.github.com/repos/fsek/web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fsek/web/merges","archive_url":"https://api.github.com/repos/fsek/web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fsek/web/downloads","issues_url":"https://api.github.com/repos/fsek/web/issues{/number}","pulls_url":"https://api.github.com/repos/fsek/web/pulls{/number}","milestones_url":"https://api.github.com/repos/fsek/web/milestones{/number}","notifications_url":"https://api.github.com/repos/fsek/web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fsek/web/labels{/name}","releases_url":"https://api.github.com/repos/fsek/web/releases{/id}","created_at":"2014-12-05T09:13:19Z","updated_at":"2015-04-25T07:33:08Z","pushed_at":"2015-04-27T09:20:47Z","git_url":"git://github.com/fsek/web.git","ssh_url":"git@github.com:fsek/web.git","clone_url":"https://github.com/fsek/web.git","svn_url":"https://github.com/fsek/web","homepage":"http://fsektionen.se","size":212120,"stargazers_count":4,"watchers_count":4,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":58,"forks":1,"open_issues":58,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fsek/web/pulls/172"},"html":{"href":"https://github.com/fsek/web/pull/172"},"issue":{"href":"https://api.github.com/repos/fsek/web/issues/172"},"comments":{"href":"https://api.github.com/repos/fsek/web/issues/172/comments"},"review_comments":{"href":"https://api.github.com/repos/fsek/web/pulls/172/comments"},"review_comment":{"href":"https://api.github.com/repos/fsek/web/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fsek/web/pulls/172/commits"},"statuses":{"href":"https://api.github.com/repos/fsek/web/statuses/88234c3861e4d381462f5512c0158c8e71297508"}}}}