GitHub PullRequestReviewCommentEvent at 2014-08-01 16:51:30
Repository: rails
Actor: rafaelfranca
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/rails/rails/pulls/comments/15706109","id":15706109,"diff_hunk":"@@ -360,11 +360,20 @@ def rename_table(table_name, new_name)\n \n       # Drops a table from the database.\n       #\n-      # Although this command ignores +options+ and the block if one is given, it can be helpful\n-      # to provide these in a migration's +change+ method so it can be reverted.\n-      # In that case, +options+ and the block will be used by create_table.\n+      # You can pass an +options+ hash that can include the following keys:\n+      # [<tt>:if_exists</tt>]\n+      #   Don't raise an error if the table does not exist\n+      #\n+      # Although this command ignores most +options+ and the block if one is\n+      # given, it can be helpful to provide these in a migration's +change+\n+      # method so it can be reverted. In that case, +options+ and the block\n+      # will be used by create_table.\n       def drop_table(table_name, options = {})\n-        execute \"DROP TABLE #{quote_table_name(table_name)}\"\n+        statement = \"DROP TABLE \"","path":"activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb","position":17,"original_position":17,"commit_id":"20b3e5e5a41a943eaed776c01f8194c0496b4d72","original_commit_id":"20b3e5e5a41a943eaed776c01f8194c0496b4d72","user":{"login":"rafaelfranca","id":47848,"avatar_url":"https://avatars.githubusercontent.com/u/47848?v=1","gravatar_id":"0525b332aafb83307b32d9747a93de03","url":"https://api.github.com/users/rafaelfranca","html_url":"https://github.com/rafaelfranca","followers_url":"https://api.github.com/users/rafaelfranca/followers","following_url":"https://api.github.com/users/rafaelfranca/following{/other_user}","gists_url":"https://api.github.com/users/rafaelfranca/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelfranca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelfranca/subscriptions","organizations_url":"https://api.github.com/users/rafaelfranca/orgs","repos_url":"https://api.github.com/users/rafaelfranca/repos","events_url":"https://api.github.com/users/rafaelfranca/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelfranca/received_events","type":"User","site_admin":false},"body":"I'd go with interpolation here.","created_at":"2014-08-01T16:51:30Z","updated_at":"2014-08-01T16:51:30Z","html_url":"https://github.com/rails/rails/pull/16366#discussion_r15706109","pull_request_url":"https://api.github.com/repos/rails/rails/pulls/16366","_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/15706109"},"html":{"href":"https://github.com/rails/rails/pull/16366#discussion_r15706109"},"pull_request":{"href":"https://api.github.com/repos/rails/rails/pulls/16366"}}},"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/16366","id":19213011,"html_url":"https://github.com/rails/rails/pull/16366","diff_url":"https://github.com/rails/rails/pull/16366.diff","patch_url":"https://github.com/rails/rails/pull/16366.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/16366","number":16366,"state":"open","title":"Add an :if_exists option to drop_table","user":{"login":"skanev","id":10382,"avatar_url":"https://avatars.githubusercontent.com/u/10382?v=1","gravatar_id":"5ca07e641fada5a88a09277c45bd7c1b","url":"https://api.github.com/users/skanev","html_url":"https://github.com/skanev","followers_url":"https://api.github.com/users/skanev/followers","following_url":"https://api.github.com/users/skanev/following{/other_user}","gists_url":"https://api.github.com/users/skanev/gists{/gist_id}","starred_url":"https://api.github.com/users/skanev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skanev/subscriptions","organizations_url":"https://api.github.com/users/skanev/orgs","repos_url":"https://api.github.com/users/skanev/repos","events_url":"https://api.github.com/users/skanev/events{/privacy}","received_events_url":"https://api.github.com/users/skanev/received_events","type":"User","site_admin":false},"body":"I think `drop_table` can benefit from an `if_exists: true` option, that does a `DROP TABLE IF EXISTS`. If nothing else, it can be useful for a bunch of tests that do this manually ([to](https://github.com/rails/rails/blob/master/activerecord/test/cases/migration/rename_table_test.rb#L86-L87) [name](https://github.com/rails/rails/blob/master/activerecord/test/cases/migration/table_and_index_test.rb#L9) [a](https://github.com/rails/rails/blob/master/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb#L19) [few](https://github.com/rails/rails/blob/master/activerecord/test/cases/migration/create_join_table_test.rb#L15)). The `DROP TABLE IF EXISTS` syntax seems to be supported in the popular database engines. I checked MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.\r\n\r\nI'm not sure if `if_exists` is the best name for this option. Suggestions are welcome, if you feel that this is a useful contribution.\r\n\r\n/cc @senny ","created_at":"2014-08-01T14:29:48Z","updated_at":"2014-08-01T16:51:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7ad3418a8cc0d8ac586d68664b8f753b14a13e83","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rails/rails/pulls/16366/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/16366/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rails/rails/issues/16366/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/20b3e5e5a41a943eaed776c01f8194c0496b4d72","head":{"label":"skanev:add-if-exists-to-drop-table","ref":"add-if-exists-to-drop-table","sha":"20b3e5e5a41a943eaed776c01f8194c0496b4d72","user":{"login":"skanev","id":10382,"avatar_url":"https://avatars.githubusercontent.com/u/10382?v=1","gravatar_id":"5ca07e641fada5a88a09277c45bd7c1b","url":"https://api.github.com/users/skanev","html_url":"https://github.com/skanev","followers_url":"https://api.github.com/users/skanev/followers","following_url":"https://api.github.com/users/skanev/following{/other_user}","gists_url":"https://api.github.com/users/skanev/gists{/gist_id}","starred_url":"https://api.github.com/users/skanev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skanev/subscriptions","organizations_url":"https://api.github.com/users/skanev/orgs","repos_url":"https://api.github.com/users/skanev/repos","events_url":"https://api.github.com/users/skanev/events{/privacy}","received_events_url":"https://api.github.com/users/skanev/received_events","type":"User","site_admin":false},"repo":{"id":21987014,"name":"rails","full_name":"skanev/rails","owner":{"login":"skanev","id":10382,"avatar_url":"https://avatars.githubusercontent.com/u/10382?v=1","gravatar_id":"5ca07e641fada5a88a09277c45bd7c1b","url":"https://api.github.com/users/skanev","html_url":"https://github.com/skanev","followers_url":"https://api.github.com/users/skanev/followers","following_url":"https://api.github.com/users/skanev/following{/other_user}","gists_url":"https://api.github.com/users/skanev/gists{/gist_id}","starred_url":"https://api.github.com/users/skanev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skanev/subscriptions","organizations_url":"https://api.github.com/users/skanev/orgs","repos_url":"https://api.github.com/users/skanev/repos","events_url":"https://api.github.com/users/skanev/events{/privacy}","received_events_url":"https://api.github.com/users/skanev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/skanev/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/skanev/rails","forks_url":"https://api.github.com/repos/skanev/rails/forks","keys_url":"https://api.github.com/repos/skanev/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/skanev/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/skanev/rails/teams","hooks_url":"https://api.github.com/repos/skanev/rails/hooks","issue_events_url":"https://api.github.com/repos/skanev/rails/issues/events{/number}","events_url":"https://api.github.com/repos/skanev/rails/events","assignees_url":"https://api.github.com/repos/skanev/rails/assignees{/user}","branches_url":"https://api.github.com/repos/skanev/rails/branches{/branch}","tags_url":"https://api.github.com/repos/skanev/rails/tags","blobs_url":"https://api.github.com/repos/skanev/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/skanev/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/skanev/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/skanev/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/skanev/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/skanev/rails/languages","stargazers_url":"https://api.github.com/repos/skanev/rails/stargazers","contributors_url":"https://api.github.com/repos/skanev/rails/contributors","subscribers_url":"https://api.github.com/repos/skanev/rails/subscribers","subscription_url":"https://api.github.com/repos/skanev/rails/subscription","commits_url":"https://api.github.com/repos/skanev/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/skanev/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/skanev/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/skanev/rails/issues/comments/{number}","contents_url":"https://api.github.com/repos/skanev/rails/contents/{+path}","compare_url":"https://api.github.com/repos/skanev/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/skanev/rails/merges","archive_url":"https://api.github.com/repos/skanev/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/skanev/rails/downloads","issues_url":"https://api.github.com/repos/skanev/rails/issues{/number}","pulls_url":"https://api.github.com/repos/skanev/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/skanev/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/skanev/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/skanev/rails/labels{/name}","releases_url":"https://api.github.com/repos/skanev/rails/releases{/id}","created_at":"2014-07-18T16:35:29Z","updated_at":"2014-07-31T10:38:57Z","pushed_at":"2014-08-01T15:39:42Z","git_url":"git://github.com/skanev/rails.git","ssh_url":"git@github.com:skanev/rails.git","clone_url":"https://github.com/skanev/rails.git","svn_url":"https://github.com/skanev/rails","homepage":"http://rubyonrails.org","size":117282,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rails:master","ref":"master","sha":"20405e516b031db4d8230014d1dcf9601ed0a0f8","user":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=1","gravatar_id":"30f39a09e233e8369dddf6feb4be0308","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"repo":{"id":8514,"name":"rails","full_name":"rails/rails","owner":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=1","gravatar_id":"30f39a09e233e8369dddf6feb4be0308","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rails/rails","description":"Ruby on Rails","fork":false,"url":"https://api.github.com/repos/rails/rails","forks_url":"https://api.github.com/repos/rails/rails/forks","keys_url":"https://api.github.com/repos/rails/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rails/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rails/rails/teams","hooks_url":"https://api.github.com/repos/rails/rails/hooks","issue_events_url":"https://api.github.com/repos/rails/rails/issues/events{/number}","events_url":"https://api.github.com/repos/rails/rails/events","assignees_url":"https://api.github.com/repos/rails/rails/assignees{/user}","branches_url":"https://api.github.com/repos/rails/rails/branches{/branch}","tags_url":"https://api.github.com/repos/rails/rails/tags","blobs_url":"https://api.github.com/repos/rails/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rails/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rails/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/rails/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rails/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/rails/rails/languages","stargazers_url":"https://api.github.com/repos/rails/rails/stargazers","contributors_url":"https://api.github.com/repos/rails/rails/contributors","subscribers_url":"https://api.github.com/repos/rails/rails/subscribers","subscription_url":"https://api.github.com/repos/rails/rails/subscription","commits_url":"https://api.github.com/repos/rails/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/rails/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/rails/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/rails/rails/issues/comments/{number}","contents_url":"https://api.github.com/repos/rails/rails/contents/{+path}","compare_url":"https://api.github.com/repos/rails/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rails/rails/merges","archive_url":"https://api.github.com/repos/rails/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rails/rails/downloads","issues_url":"https://api.github.com/repos/rails/rails/issues{/number}","pulls_url":"https://api.github.com/repos/rails/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/rails/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/rails/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rails/rails/labels{/name}","releases_url":"https://api.github.com/repos/rails/rails/releases{/id}","created_at":"2008-04-11T02:19:47Z","updated_at":"2014-08-01T16:09:25Z","pushed_at":"2014-08-01T03:46:11Z","git_url":"git://github.com/rails/rails.git","ssh_url":"git@github.com:rails/rails.git","clone_url":"https://github.com/rails/rails.git","svn_url":"https://github.com/rails/rails","homepage":"http://rubyonrails.org","size":353885,"stargazers_count":22677,"watchers_count":22677,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"forks_count":8481,"mirror_url":null,"open_issues_count":643,"forks":8481,"open_issues":643,"watchers":22677,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/16366"},"html":{"href":"https://github.com/rails/rails/pull/16366"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/16366"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/16366/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/16366/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/16366/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/20b3e5e5a41a943eaed776c01f8194c0496b4d72"}}}}