{"action":"opened","number":21871,"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/21871","id":46806099,"html_url":"https://github.com/rails/rails/pull/21871","diff_url":"https://github.com/rails/rails/pull/21871.diff","patch_url":"https://github.com/rails/rails/pull/21871.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/21871","number":21871,"state":"open","locked":false,"title":"MySQL 5.6.5 and greater supports functions as column default values.","user":{"login":"neutronz","id":168254,"avatar_url":"https://avatars.githubusercontent.com/u/168254?v=3","gravatar_id":"","url":"https://api.github.com/users/neutronz","html_url":"https://github.com/neutronz","followers_url":"https://api.github.com/users/neutronz/followers","following_url":"https://api.github.com/users/neutronz/following{/other_user}","gists_url":"https://api.github.com/users/neutronz/gists{/gist_id}","starred_url":"https://api.github.com/users/neutronz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neutronz/subscriptions","organizations_url":"https://api.github.com/users/neutronz/orgs","repos_url":"https://api.github.com/users/neutronz/repos","events_url":"https://api.github.com/users/neutronz/events{/privacy}","received_events_url":"https://api.github.com/users/neutronz/received_events","type":"User","site_admin":false},"body":"However in AR, default options are quoted which doesn't allow for\r\npassing in these functions.\r\n\r\nFor example, attempting to rename a column with a default value\r\nthat is function would result in this sql being generated and thro\r\nan error:\r\n\r\n  ALTER TABLE `test_models` ADD `mysql_tested_at` datetime DEFAULT\r\n  'CURRENT_TIMESTAMP' NOT NULL\r\n\r\nThere are various workarounds for column creation seen here:\r\nhttp://www.mikeperham.com/2014/05/17/setting-mysql-datetime-column-defaults-in-rails/\r\nbut not for renaming and again those are hacks.\r\n\r\nThis commit tests underlying support for\r\nthe function (if it is a function) then bypasses quoting the\r\ndefault value.\r\n\r\nhttps://dev.mysql.com/doc/refman/5.6/en/timestamp-initialization.html\r\nhttp://optimize-this.blogspot.com/2012/04/datetime-default-now-finally-available.html","created_at":"2015-10-05T16:58:21Z","updated_at":"2015-10-05T16:58:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"83fdf4e7139d2ccdb60452a6608e753aca1b32be","assignee":{"login":"chancancode","id":55829,"avatar_url":"https://avatars.githubusercontent.com/u/55829?v=3","gravatar_id":"","url":"https://api.github.com/users/chancancode","html_url":"https://github.com/chancancode","followers_url":"https://api.github.com/users/chancancode/followers","following_url":"https://api.github.com/users/chancancode/following{/other_user}","gists_url":"https://api.github.com/users/chancancode/gists{/gist_id}","starred_url":"https://api.github.com/users/chancancode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chancancode/subscriptions","organizations_url":"https://api.github.com/users/chancancode/orgs","repos_url":"https://api.github.com/users/chancancode/repos","events_url":"https://api.github.com/users/chancancode/events{/privacy}","received_events_url":"https://api.github.com/users/chancancode/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/rails/rails/pulls/21871/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/21871/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails/rails/issues/21871/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/089bec9e099052b14d7791dc56f2c0b948c68491","head":{"label":"neutronz:add-support-for-mysql-function-as-column-defaults","ref":"add-support-for-mysql-function-as-column-defaults","sha":"089bec9e099052b14d7791dc56f2c0b948c68491","user":{"login":"neutronz","id":168254,"avatar_url":"https://avatars.githubusercontent.com/u/168254?v=3","gravatar_id":"","url":"https://api.github.com/users/neutronz","html_url":"https://github.com/neutronz","followers_url":"https://api.github.com/users/neutronz/followers","following_url":"https://api.github.com/users/neutronz/following{/other_user}","gists_url":"https://api.github.com/users/neutronz/gists{/gist_id}","starred_url":"https://api.github.com/users/neutronz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neutronz/subscriptions","organizations_url":"https://api.github.com/users/neutronz/orgs","repos_url":"https://api.github.com/users/neutronz/repos","events_url":"https://api.github.com/users/neutronz/events{/privacy}","received_events_url":"https://api.github.com/users/neutronz/received_events","type":"User","site_admin":false},"repo":{"id":43697212,"name":"rails","full_name":"neutronz/rails","owner":{"login":"neutronz","id":168254,"avatar_url":"https://avatars.githubusercontent.com/u/168254?v=3","gravatar_id":"","url":"https://api.github.com/users/neutronz","html_url":"https://github.com/neutronz","followers_url":"https://api.github.com/users/neutronz/followers","following_url":"https://api.github.com/users/neutronz/following{/other_user}","gists_url":"https://api.github.com/users/neutronz/gists{/gist_id}","starred_url":"https://api.github.com/users/neutronz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neutronz/subscriptions","organizations_url":"https://api.github.com/users/neutronz/orgs","repos_url":"https://api.github.com/users/neutronz/repos","events_url":"https://api.github.com/users/neutronz/events{/privacy}","received_events_url":"https://api.github.com/users/neutronz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/neutronz/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/neutronz/rails","forks_url":"https://api.github.com/repos/neutronz/rails/forks","keys_url":"https://api.github.com/repos/neutronz/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neutronz/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neutronz/rails/teams","hooks_url":"https://api.github.com/repos/neutronz/rails/hooks","issue_events_url":"https://api.github.com/repos/neutronz/rails/issues/events{/number}","events_url":"https://api.github.com/repos/neutronz/rails/events","assignees_url":"https://api.github.com/repos/neutronz/rails/assignees{/user}","branches_url":"https://api.github.com/repos/neutronz/rails/branches{/branch}","tags_url":"https://api.github.com/repos/neutronz/rails/tags","blobs_url":"https://api.github.com/repos/neutronz/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neutronz/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neutronz/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/neutronz/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neutronz/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/neutronz/rails/languages","stargazers_url":"https://api.github.com/repos/neutronz/rails/stargazers","contributors_url":"https://api.github.com/repos/neutronz/rails/contributors","subscribers_url":"https://api.github.com/repos/neutronz/rails/subscribers","subscription_url":"https://api.github.com/repos/neutronz/rails/subscription","commits_url":"https://api.github.com/repos/neutronz/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/neutronz/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/neutronz/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/neutronz/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/neutronz/rails/contents/{+path}","compare_url":"https://api.github.com/repos/neutronz/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neutronz/rails/merges","archive_url":"https://api.github.com/repos/neutronz/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neutronz/rails/downloads","issues_url":"https://api.github.com/repos/neutronz/rails/issues{/number}","pulls_url":"https://api.github.com/repos/neutronz/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/neutronz/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/neutronz/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neutronz/rails/labels{/name}","releases_url":"https://api.github.com/repos/neutronz/rails/releases{/id}","created_at":"2015-10-05T16:12:47Z","updated_at":"2015-10-05T16:13:25Z","pushed_at":"2015-10-05T16:58:05Z","git_url":"git://github.com/neutronz/rails.git","ssh_url":"git@github.com:neutronz/rails.git","clone_url":"https://github.com/neutronz/rails.git","svn_url":"https://github.com/neutronz/rails","homepage":"http://rubyonrails.org","size":465564,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":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":"db448209bd70e2e662de8aa5527f30a38fd378a9","user":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","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=3","gravatar_id":"","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":"2015-10-05T16:28:06Z","pushed_at":"2015-10-05T16:58:22Z","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":465564,"stargazers_count":27917,"watchers_count":27917,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11235,"mirror_url":null,"open_issues_count":879,"forks":11235,"open_issues":879,"watchers":27917,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/21871"},"html":{"href":"https://github.com/rails/rails/pull/21871"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/21871"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/21871/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/21871/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/21871/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/089bec9e099052b14d7791dc56f2c0b948c68491"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":1,"review_comments":0,"commits":1,"additions":40,"deletions":1,"changed_files":3}}