{"action":"created","comment":{"url":"https://api.github.com/repos/thoughtbot/scenic/pulls/comments/49042593","id":49042593,"diff_hunk":"@@ -0,0 +1,63 @@\n+module Scenic\n+  module Adapters\n+    class Postgres\n+      # Dropping a materialized view causes all indexes on the materialized view\n+      # to be dropped. This object can be used to capture the existing\n+      # materialized views before updating the materialized view and then\n+      # reapplying after.\n+      #\n+      # @api private\n+      class IndexReapplication\n+        def initialize(connection:, speaker: ActiveRecord::Migration)\n+          @connection = connection\n+          @speaker = speaker\n+        end\n+\n+        # Caches indexes on the provided object before executing the block and\n+        # then reapplying the indexes. Errors in applying the indexes are caught\n+        # and logged to output.\n+        #\n+        # @param on The name of the object we are reapplying indexes on.\n+        # @yield Operations to perform before reapplying indexes. @return [void]","path":"lib/scenic/adapters/postgres/index_reapplication.rb","position":21,"original_position":21,"commit_id":"1f83eaef98b9022323000effec24f6bb158a54ce","original_commit_id":"1f83eaef98b9022323000effec24f6bb158a54ce","user":{"login":"calebthompson","id":711717,"avatar_url":"https://avatars.githubusercontent.com/u/711717?v=3","gravatar_id":"","url":"https://api.github.com/users/calebthompson","html_url":"https://github.com/calebthompson","followers_url":"https://api.github.com/users/calebthompson/followers","following_url":"https://api.github.com/users/calebthompson/following{/other_user}","gists_url":"https://api.github.com/users/calebthompson/gists{/gist_id}","starred_url":"https://api.github.com/users/calebthompson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calebthompson/subscriptions","organizations_url":"https://api.github.com/users/calebthompson/orgs","repos_url":"https://api.github.com/users/calebthompson/repos","events_url":"https://api.github.com/users/calebthompson/events{/privacy}","received_events_url":"https://api.github.com/users/calebthompson/received_events","type":"User","site_admin":false},"body":"newline before `@return`","created_at":"2016-01-07T05:10:59Z","updated_at":"2016-01-07T05:10:59Z","html_url":"https://github.com/thoughtbot/scenic/pull/119#discussion_r49042593","pull_request_url":"https://api.github.com/repos/thoughtbot/scenic/pulls/119","_links":{"self":{"href":"https://api.github.com/repos/thoughtbot/scenic/pulls/comments/49042593"},"html":{"href":"https://github.com/thoughtbot/scenic/pull/119#discussion_r49042593"},"pull_request":{"href":"https://api.github.com/repos/thoughtbot/scenic/pulls/119"}}},"pull_request":{"url":"https://api.github.com/repos/thoughtbot/scenic/pulls/119","id":55051944,"html_url":"https://github.com/thoughtbot/scenic/pull/119","diff_url":"https://github.com/thoughtbot/scenic/pull/119.diff","patch_url":"https://github.com/thoughtbot/scenic/pull/119.patch","issue_url":"https://api.github.com/repos/thoughtbot/scenic/issues/119","number":119,"state":"open","locked":false,"title":"Refactor view updates","user":{"login":"derekprior","id":152152,"avatar_url":"https://avatars.githubusercontent.com/u/152152?v=3","gravatar_id":"","url":"https://api.github.com/users/derekprior","html_url":"https://github.com/derekprior","followers_url":"https://api.github.com/users/derekprior/followers","following_url":"https://api.github.com/users/derekprior/following{/other_user}","gists_url":"https://api.github.com/users/derekprior/gists{/gist_id}","starred_url":"https://api.github.com/users/derekprior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derekprior/subscriptions","organizations_url":"https://api.github.com/users/derekprior/orgs","repos_url":"https://api.github.com/users/derekprior/repos","events_url":"https://api.github.com/users/derekprior/events{/privacy}","received_events_url":"https://api.github.com/users/derekprior/received_events","type":"User","site_admin":false},"body":"This introduces `update_view` and `update_materialized_view` as methods\r\non the Postgres adapter. The schema statements previously expressed\r\nthese methods in terms of `drop_view` and `create_view`, wrapped in a\r\ncall to our index reapplication code. Breaking these methods out allows\r\nother adapters to implement these as they see fit, and also allows us to\r\nmake that index reapplication index a private implementation detail of\r\nthe adapter.\r\n\r\nI also extracted an indexes query object (like the views query object)\r\nand the index reapplication object to clean up the private methods on\r\nthe adapter itself.","created_at":"2016-01-05T03:46:46Z","updated_at":"2016-01-07T05:10:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5097e2b04dcdec90674afec827f2b2f2609b54c1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/thoughtbot/scenic/pulls/119/commits","review_comments_url":"https://api.github.com/repos/thoughtbot/scenic/pulls/119/comments","review_comment_url":"https://api.github.com/repos/thoughtbot/scenic/pulls/comments{/number}","comments_url":"https://api.github.com/repos/thoughtbot/scenic/issues/119/comments","statuses_url":"https://api.github.com/repos/thoughtbot/scenic/statuses/1f83eaef98b9022323000effec24f6bb158a54ce","head":{"label":"thoughtbot:dp-update-refactor","ref":"dp-update-refactor","sha":"1f83eaef98b9022323000effec24f6bb158a54ce","user":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?v=3","gravatar_id":"","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"repo":{"id":19283674,"name":"scenic","full_name":"thoughtbot/scenic","owner":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?v=3","gravatar_id":"","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thoughtbot/scenic","description":"Versioned database views for Rails","fork":false,"url":"https://api.github.com/repos/thoughtbot/scenic","forks_url":"https://api.github.com/repos/thoughtbot/scenic/forks","keys_url":"https://api.github.com/repos/thoughtbot/scenic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thoughtbot/scenic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thoughtbot/scenic/teams","hooks_url":"https://api.github.com/repos/thoughtbot/scenic/hooks","issue_events_url":"https://api.github.com/repos/thoughtbot/scenic/issues/events{/number}","events_url":"https://api.github.com/repos/thoughtbot/scenic/events","assignees_url":"https://api.github.com/repos/thoughtbot/scenic/assignees{/user}","branches_url":"https://api.github.com/repos/thoughtbot/scenic/branches{/branch}","tags_url":"https://api.github.com/repos/thoughtbot/scenic/tags","blobs_url":"https://api.github.com/repos/thoughtbot/scenic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thoughtbot/scenic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thoughtbot/scenic/git/refs{/sha}","trees_url":"https://api.github.com/repos/thoughtbot/scenic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thoughtbot/scenic/statuses/{sha}","languages_url":"https://api.github.com/repos/thoughtbot/scenic/languages","stargazers_url":"https://api.github.com/repos/thoughtbot/scenic/stargazers","contributors_url":"https://api.github.com/repos/thoughtbot/scenic/contributors","subscribers_url":"https://api.github.com/repos/thoughtbot/scenic/subscribers","subscription_url":"https://api.github.com/repos/thoughtbot/scenic/subscription","commits_url":"https://api.github.com/repos/thoughtbot/scenic/commits{/sha}","git_commits_url":"https://api.github.com/repos/thoughtbot/scenic/git/commits{/sha}","comments_url":"https://api.github.com/repos/thoughtbot/scenic/comments{/number}","issue_comment_url":"https://api.github.com/repos/thoughtbot/scenic/issues/comments{/number}","contents_url":"https://api.github.com/repos/thoughtbot/scenic/contents/{+path}","compare_url":"https://api.github.com/repos/thoughtbot/scenic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thoughtbot/scenic/merges","archive_url":"https://api.github.com/repos/thoughtbot/scenic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thoughtbot/scenic/downloads","issues_url":"https://api.github.com/repos/thoughtbot/scenic/issues{/number}","pulls_url":"https://api.github.com/repos/thoughtbot/scenic/pulls{/number}","milestones_url":"https://api.github.com/repos/thoughtbot/scenic/milestones{/number}","notifications_url":"https://api.github.com/repos/thoughtbot/scenic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thoughtbot/scenic/labels{/name}","releases_url":"https://api.github.com/repos/thoughtbot/scenic/releases{/id}","created_at":"2014-04-29T16:36:17Z","updated_at":"2016-01-07T00:58:49Z","pushed_at":"2016-01-06T01:41:08Z","git_url":"git://github.com/thoughtbot/scenic.git","ssh_url":"git@github.com:thoughtbot/scenic.git","clone_url":"https://github.com/thoughtbot/scenic.git","svn_url":"https://github.com/thoughtbot/scenic","homepage":"","size":209,"stargazers_count":184,"watchers_count":184,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":3,"forks":20,"open_issues":3,"watchers":184,"default_branch":"master"}},"base":{"label":"thoughtbot:master","ref":"master","sha":"5c8e7a866f99bbf7e18c95815c8c6b335c5f92c6","user":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?v=3","gravatar_id":"","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"repo":{"id":19283674,"name":"scenic","full_name":"thoughtbot/scenic","owner":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?v=3","gravatar_id":"","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thoughtbot/scenic","description":"Versioned database views for Rails","fork":false,"url":"https://api.github.com/repos/thoughtbot/scenic","forks_url":"https://api.github.com/repos/thoughtbot/scenic/forks","keys_url":"https://api.github.com/repos/thoughtbot/scenic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thoughtbot/scenic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thoughtbot/scenic/teams","hooks_url":"https://api.github.com/repos/thoughtbot/scenic/hooks","issue_events_url":"https://api.github.com/repos/thoughtbot/scenic/issues/events{/number}","events_url":"https://api.github.com/repos/thoughtbot/scenic/events","assignees_url":"https://api.github.com/repos/thoughtbot/scenic/assignees{/user}","branches_url":"https://api.github.com/repos/thoughtbot/scenic/branches{/branch}","tags_url":"https://api.github.com/repos/thoughtbot/scenic/tags","blobs_url":"https://api.github.com/repos/thoughtbot/scenic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thoughtbot/scenic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thoughtbot/scenic/git/refs{/sha}","trees_url":"https://api.github.com/repos/thoughtbot/scenic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thoughtbot/scenic/statuses/{sha}","languages_url":"https://api.github.com/repos/thoughtbot/scenic/languages","stargazers_url":"https://api.github.com/repos/thoughtbot/scenic/stargazers","contributors_url":"https://api.github.com/repos/thoughtbot/scenic/contributors","subscribers_url":"https://api.github.com/repos/thoughtbot/scenic/subscribers","subscription_url":"https://api.github.com/repos/thoughtbot/scenic/subscription","commits_url":"https://api.github.com/repos/thoughtbot/scenic/commits{/sha}","git_commits_url":"https://api.github.com/repos/thoughtbot/scenic/git/commits{/sha}","comments_url":"https://api.github.com/repos/thoughtbot/scenic/comments{/number}","issue_comment_url":"https://api.github.com/repos/thoughtbot/scenic/issues/comments{/number}","contents_url":"https://api.github.com/repos/thoughtbot/scenic/contents/{+path}","compare_url":"https://api.github.com/repos/thoughtbot/scenic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thoughtbot/scenic/merges","archive_url":"https://api.github.com/repos/thoughtbot/scenic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thoughtbot/scenic/downloads","issues_url":"https://api.github.com/repos/thoughtbot/scenic/issues{/number}","pulls_url":"https://api.github.com/repos/thoughtbot/scenic/pulls{/number}","milestones_url":"https://api.github.com/repos/thoughtbot/scenic/milestones{/number}","notifications_url":"https://api.github.com/repos/thoughtbot/scenic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thoughtbot/scenic/labels{/name}","releases_url":"https://api.github.com/repos/thoughtbot/scenic/releases{/id}","created_at":"2014-04-29T16:36:17Z","updated_at":"2016-01-07T00:58:49Z","pushed_at":"2016-01-06T01:41:08Z","git_url":"git://github.com/thoughtbot/scenic.git","ssh_url":"git@github.com:thoughtbot/scenic.git","clone_url":"https://github.com/thoughtbot/scenic.git","svn_url":"https://github.com/thoughtbot/scenic","homepage":"","size":209,"stargazers_count":184,"watchers_count":184,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":3,"forks":20,"open_issues":3,"watchers":184,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thoughtbot/scenic/pulls/119"},"html":{"href":"https://github.com/thoughtbot/scenic/pull/119"},"issue":{"href":"https://api.github.com/repos/thoughtbot/scenic/issues/119"},"comments":{"href":"https://api.github.com/repos/thoughtbot/scenic/issues/119/comments"},"review_comments":{"href":"https://api.github.com/repos/thoughtbot/scenic/pulls/119/comments"},"review_comment":{"href":"https://api.github.com/repos/thoughtbot/scenic/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/thoughtbot/scenic/pulls/119/commits"},"statuses":{"href":"https://api.github.com/repos/thoughtbot/scenic/statuses/1f83eaef98b9022323000effec24f6bb158a54ce"}}}}