{"action":"created","comment":{"url":"https://api.github.com/repos/redbooth/percona_migrator/pulls/comments/58376348","id":58376348,"diff_hunk":"@@ -64,7 +80,15 @@ def execute(command)\n \n     private\n \n-    attr_reader :command, :logger, :status\n+    attr_reader :command, :logger, :status, :cli_generator, :mysql_adapter\n+\n+    # Checks whether the sql statement is an ALTER TABLE\n+    #\n+    # @param sql [String]\n+    # @return [Boolean]\n+    def alter_statement?(sql)\n+      sql =~ /alter table/i","path":"lib/percona_migrator/runner.rb","position":41,"original_position":41,"commit_id":"182a0a93f0f2d38aa9b011e33fb1b88a0076a4fb","original_commit_id":"182a0a93f0f2d38aa9b011e33fb1b88a0076a4fb","user":{"login":"ivanilves","id":9897741,"avatar_url":"https://avatars.githubusercontent.com/u/9897741?v=3","gravatar_id":"","url":"https://api.github.com/users/ivanilves","html_url":"https://github.com/ivanilves","followers_url":"https://api.github.com/users/ivanilves/followers","following_url":"https://api.github.com/users/ivanilves/following{/other_user}","gists_url":"https://api.github.com/users/ivanilves/gists{/gist_id}","starred_url":"https://api.github.com/users/ivanilves/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivanilves/subscriptions","organizations_url":"https://api.github.com/users/ivanilves/orgs","repos_url":"https://api.github.com/users/ivanilves/repos","events_url":"https://api.github.com/users/ivanilves/events{/privacy}","received_events_url":"https://api.github.com/users/ivanilves/received_events","type":"User","site_admin":false},"body":"`/\\Aalter table/i`","created_at":"2016-04-04T13:40:20Z","updated_at":"2016-04-04T13:40:20Z","html_url":"https://github.com/redbooth/percona_migrator/pull/27#discussion_r58376348","pull_request_url":"https://api.github.com/repos/redbooth/percona_migrator/pulls/27","_links":{"self":{"href":"https://api.github.com/repos/redbooth/percona_migrator/pulls/comments/58376348"},"html":{"href":"https://github.com/redbooth/percona_migrator/pull/27#discussion_r58376348"},"pull_request":{"href":"https://api.github.com/repos/redbooth/percona_migrator/pulls/27"}}},"pull_request":{"url":"https://api.github.com/repos/redbooth/percona_migrator/pulls/27","id":63507161,"html_url":"https://github.com/redbooth/percona_migrator/pull/27","diff_url":"https://github.com/redbooth/percona_migrator/pull/27.diff","patch_url":"https://github.com/redbooth/percona_migrator/pull/27.patch","issue_url":"https://api.github.com/repos/redbooth/percona_migrator/issues/27","number":27,"state":"open","locked":false,"title":"Runner as connection client","user":{"login":"sauloperez","id":762088,"avatar_url":"https://avatars.githubusercontent.com/u/762088?v=3","gravatar_id":"","url":"https://api.github.com/users/sauloperez","html_url":"https://github.com/sauloperez","followers_url":"https://api.github.com/users/sauloperez/followers","following_url":"https://api.github.com/users/sauloperez/following{/other_user}","gists_url":"https://api.github.com/users/sauloperez/gists{/gist_id}","starred_url":"https://api.github.com/users/sauloperez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sauloperez/subscriptions","organizations_url":"https://api.github.com/users/sauloperez/orgs","repos_url":"https://api.github.com/users/sauloperez/repos","events_url":"https://api.github.com/users/sauloperez/events{/privacy}","received_events_url":"https://api.github.com/users/sauloperez/received_events","type":"User","site_admin":false},"body":"This is an attempt of refactoring the adapter by implementing `#query` in `Runner`. This is the method all underlying connection clients implement and gets called by ActiveRecord to finally execute the SQL statement.\r\n\r\nBy folllowing the AR's way and reducing the coupling with the mysql2 adapter, we'll make the percona adapter my flexible and more robust.\r\n\r\n## Implementation\r\n\r\nNow, as `@connection` contains the actual `Runner` instance, the `AbstractMysqlAdapter#execute` method calls it for us wrapping any raised exceptions.\r\n\r\nWhen the received sql is an ALTER TABLE statement it goes through `pt-online-schema-change`, spawning a process and so on. Otherwise, it delegates the execution to the mysql adapter, as they would have gone without percona.","created_at":"2016-03-20T20:57:42Z","updated_at":"2016-04-04T13:40:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"db578900f7a4308608de5f4c0293d3757a8c0730","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/redbooth/percona_migrator/pulls/27/commits","review_comments_url":"https://api.github.com/repos/redbooth/percona_migrator/pulls/27/comments","review_comment_url":"https://api.github.com/repos/redbooth/percona_migrator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/redbooth/percona_migrator/issues/27/comments","statuses_url":"https://api.github.com/repos/redbooth/percona_migrator/statuses/182a0a93f0f2d38aa9b011e33fb1b88a0076a4fb","head":{"label":"redbooth:runner-as-connection-client","ref":"runner-as-connection-client","sha":"182a0a93f0f2d38aa9b011e33fb1b88a0076a4fb","user":{"login":"redbooth","id":7304334,"avatar_url":"https://avatars.githubusercontent.com/u/7304334?v=3","gravatar_id":"","url":"https://api.github.com/users/redbooth","html_url":"https://github.com/redbooth","followers_url":"https://api.github.com/users/redbooth/followers","following_url":"https://api.github.com/users/redbooth/following{/other_user}","gists_url":"https://api.github.com/users/redbooth/gists{/gist_id}","starred_url":"https://api.github.com/users/redbooth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redbooth/subscriptions","organizations_url":"https://api.github.com/users/redbooth/orgs","repos_url":"https://api.github.com/users/redbooth/repos","events_url":"https://api.github.com/users/redbooth/events{/privacy}","received_events_url":"https://api.github.com/users/redbooth/received_events","type":"Organization","site_admin":false},"repo":{"id":47969607,"name":"percona_migrator","full_name":"redbooth/percona_migrator","owner":{"login":"redbooth","id":7304334,"avatar_url":"https://avatars.githubusercontent.com/u/7304334?v=3","gravatar_id":"","url":"https://api.github.com/users/redbooth","html_url":"https://github.com/redbooth","followers_url":"https://api.github.com/users/redbooth/followers","following_url":"https://api.github.com/users/redbooth/following{/other_user}","gists_url":"https://api.github.com/users/redbooth/gists{/gist_id}","starred_url":"https://api.github.com/users/redbooth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redbooth/subscriptions","organizations_url":"https://api.github.com/users/redbooth/orgs","repos_url":"https://api.github.com/users/redbooth/repos","events_url":"https://api.github.com/users/redbooth/events{/privacy}","received_events_url":"https://api.github.com/users/redbooth/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/redbooth/percona_migrator","description":"Percona's pt-online-schema-change runner for ActiveRecord migrations","fork":false,"url":"https://api.github.com/repos/redbooth/percona_migrator","forks_url":"https://api.github.com/repos/redbooth/percona_migrator/forks","keys_url":"https://api.github.com/repos/redbooth/percona_migrator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/redbooth/percona_migrator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/redbooth/percona_migrator/teams","hooks_url":"https://api.github.com/repos/redbooth/percona_migrator/hooks","issue_events_url":"https://api.github.com/repos/redbooth/percona_migrator/issues/events{/number}","events_url":"https://api.github.com/repos/redbooth/percona_migrator/events","assignees_url":"https://api.github.com/repos/redbooth/percona_migrator/assignees{/user}","branches_url":"https://api.github.com/repos/redbooth/percona_migrator/branches{/branch}","tags_url":"https://api.github.com/repos/redbooth/percona_migrator/tags","blobs_url":"https://api.github.com/repos/redbooth/percona_migrator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/redbooth/percona_migrator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/redbooth/percona_migrator/git/refs{/sha}","trees_url":"https://api.github.com/repos/redbooth/percona_migrator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/redbooth/percona_migrator/statuses/{sha}","languages_url":"https://api.github.com/repos/redbooth/percona_migrator/languages","stargazers_url":"https://api.github.com/repos/redbooth/percona_migrator/stargazers","contributors_url":"https://api.github.com/repos/redbooth/percona_migrator/contributors","subscribers_url":"https://api.github.com/repos/redbooth/percona_migrator/subscribers","subscription_url":"https://api.github.com/repos/redbooth/percona_migrator/subscription","commits_url":"https://api.github.com/repos/redbooth/percona_migrator/commits{/sha}","git_commits_url":"https://api.github.com/repos/redbooth/percona_migrator/git/commits{/sha}","comments_url":"https://api.github.com/repos/redbooth/percona_migrator/comments{/number}","issue_comment_url":"https://api.github.com/repos/redbooth/percona_migrator/issues/comments{/number}","contents_url":"https://api.github.com/repos/redbooth/percona_migrator/contents/{+path}","compare_url":"https://api.github.com/repos/redbooth/percona_migrator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/redbooth/percona_migrator/merges","archive_url":"https://api.github.com/repos/redbooth/percona_migrator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/redbooth/percona_migrator/downloads","issues_url":"https://api.github.com/repos/redbooth/percona_migrator/issues{/number}","pulls_url":"https://api.github.com/repos/redbooth/percona_migrator/pulls{/number}","milestones_url":"https://api.github.com/repos/redbooth/percona_migrator/milestones{/number}","notifications_url":"https://api.github.com/repos/redbooth/percona_migrator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/redbooth/percona_migrator/labels{/name}","releases_url":"https://api.github.com/repos/redbooth/percona_migrator/releases{/id}","deployments_url":"https://api.github.com/repos/redbooth/percona_migrator/deployments","created_at":"2015-12-14T11:00:12Z","updated_at":"2016-03-31T14:26:34Z","pushed_at":"2016-04-03T19:07:08Z","git_url":"git://github.com/redbooth/percona_migrator.git","ssh_url":"git@github.com:redbooth/percona_migrator.git","clone_url":"https://github.com/redbooth/percona_migrator.git","svn_url":"https://github.com/redbooth/percona_migrator","homepage":"","size":152,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":4,"default_branch":"master"}},"base":{"label":"redbooth:master","ref":"master","sha":"fff433140ecd51f63ac37dcfa32f5abd2c512fdc","user":{"login":"redbooth","id":7304334,"avatar_url":"https://avatars.githubusercontent.com/u/7304334?v=3","gravatar_id":"","url":"https://api.github.com/users/redbooth","html_url":"https://github.com/redbooth","followers_url":"https://api.github.com/users/redbooth/followers","following_url":"https://api.github.com/users/redbooth/following{/other_user}","gists_url":"https://api.github.com/users/redbooth/gists{/gist_id}","starred_url":"https://api.github.com/users/redbooth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redbooth/subscriptions","organizations_url":"https://api.github.com/users/redbooth/orgs","repos_url":"https://api.github.com/users/redbooth/repos","events_url":"https://api.github.com/users/redbooth/events{/privacy}","received_events_url":"https://api.github.com/users/redbooth/received_events","type":"Organization","site_admin":false},"repo":{"id":47969607,"name":"percona_migrator","full_name":"redbooth/percona_migrator","owner":{"login":"redbooth","id":7304334,"avatar_url":"https://avatars.githubusercontent.com/u/7304334?v=3","gravatar_id":"","url":"https://api.github.com/users/redbooth","html_url":"https://github.com/redbooth","followers_url":"https://api.github.com/users/redbooth/followers","following_url":"https://api.github.com/users/redbooth/following{/other_user}","gists_url":"https://api.github.com/users/redbooth/gists{/gist_id}","starred_url":"https://api.github.com/users/redbooth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redbooth/subscriptions","organizations_url":"https://api.github.com/users/redbooth/orgs","repos_url":"https://api.github.com/users/redbooth/repos","events_url":"https://api.github.com/users/redbooth/events{/privacy}","received_events_url":"https://api.github.com/users/redbooth/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/redbooth/percona_migrator","description":"Percona's pt-online-schema-change runner for ActiveRecord migrations","fork":false,"url":"https://api.github.com/repos/redbooth/percona_migrator","forks_url":"https://api.github.com/repos/redbooth/percona_migrator/forks","keys_url":"https://api.github.com/repos/redbooth/percona_migrator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/redbooth/percona_migrator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/redbooth/percona_migrator/teams","hooks_url":"https://api.github.com/repos/redbooth/percona_migrator/hooks","issue_events_url":"https://api.github.com/repos/redbooth/percona_migrator/issues/events{/number}","events_url":"https://api.github.com/repos/redbooth/percona_migrator/events","assignees_url":"https://api.github.com/repos/redbooth/percona_migrator/assignees{/user}","branches_url":"https://api.github.com/repos/redbooth/percona_migrator/branches{/branch}","tags_url":"https://api.github.com/repos/redbooth/percona_migrator/tags","blobs_url":"https://api.github.com/repos/redbooth/percona_migrator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/redbooth/percona_migrator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/redbooth/percona_migrator/git/refs{/sha}","trees_url":"https://api.github.com/repos/redbooth/percona_migrator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/redbooth/percona_migrator/statuses/{sha}","languages_url":"https://api.github.com/repos/redbooth/percona_migrator/languages","stargazers_url":"https://api.github.com/repos/redbooth/percona_migrator/stargazers","contributors_url":"https://api.github.com/repos/redbooth/percona_migrator/contributors","subscribers_url":"https://api.github.com/repos/redbooth/percona_migrator/subscribers","subscription_url":"https://api.github.com/repos/redbooth/percona_migrator/subscription","commits_url":"https://api.github.com/repos/redbooth/percona_migrator/commits{/sha}","git_commits_url":"https://api.github.com/repos/redbooth/percona_migrator/git/commits{/sha}","comments_url":"https://api.github.com/repos/redbooth/percona_migrator/comments{/number}","issue_comment_url":"https://api.github.com/repos/redbooth/percona_migrator/issues/comments{/number}","contents_url":"https://api.github.com/repos/redbooth/percona_migrator/contents/{+path}","compare_url":"https://api.github.com/repos/redbooth/percona_migrator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/redbooth/percona_migrator/merges","archive_url":"https://api.github.com/repos/redbooth/percona_migrator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/redbooth/percona_migrator/downloads","issues_url":"https://api.github.com/repos/redbooth/percona_migrator/issues{/number}","pulls_url":"https://api.github.com/repos/redbooth/percona_migrator/pulls{/number}","milestones_url":"https://api.github.com/repos/redbooth/percona_migrator/milestones{/number}","notifications_url":"https://api.github.com/repos/redbooth/percona_migrator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/redbooth/percona_migrator/labels{/name}","releases_url":"https://api.github.com/repos/redbooth/percona_migrator/releases{/id}","deployments_url":"https://api.github.com/repos/redbooth/percona_migrator/deployments","created_at":"2015-12-14T11:00:12Z","updated_at":"2016-03-31T14:26:34Z","pushed_at":"2016-04-03T19:07:08Z","git_url":"git://github.com/redbooth/percona_migrator.git","ssh_url":"git@github.com:redbooth/percona_migrator.git","clone_url":"https://github.com/redbooth/percona_migrator.git","svn_url":"https://github.com/redbooth/percona_migrator","homepage":"","size":152,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/redbooth/percona_migrator/pulls/27"},"html":{"href":"https://github.com/redbooth/percona_migrator/pull/27"},"issue":{"href":"https://api.github.com/repos/redbooth/percona_migrator/issues/27"},"comments":{"href":"https://api.github.com/repos/redbooth/percona_migrator/issues/27/comments"},"review_comments":{"href":"https://api.github.com/repos/redbooth/percona_migrator/pulls/27/comments"},"review_comment":{"href":"https://api.github.com/repos/redbooth/percona_migrator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/redbooth/percona_migrator/pulls/27/commits"},"statuses":{"href":"https://api.github.com/repos/redbooth/percona_migrator/statuses/182a0a93f0f2d38aa9b011e33fb1b88a0076a4fb"}}}}