{"action":"created","comment":{"url":"https://api.github.com/repos/rails/rails/pulls/comments/27192944","id":27192944,"diff_hunk":"@@ -158,6 +158,21 @@ db_namespace = namespace :db do\n     puts \"Current version: #{ActiveRecord::Migrator.current_version}\"\n   end\n \n+  namespace :version do\n+    desc 'Prints the current schema version number'\n+    task :number => [:environment, :load_config] do\n+      puts ActiveRecord::Migrator.current_version\n+    end\n+\n+    desc \"Prints the file path of current schema's migration\"\n+    task :file => [:environment, :load_config] do\n+      current_version = ActiveRecord::Migrator.current_version.to_s\n+      migration_file = Dir.glob(\"#{ActiveRecord::Migrator.migrations_path}/*.rb\")","path":"activerecord/lib/active_record/railties/databases.rake","position":13,"original_position":13,"commit_id":"ef98e04a57cb62a916cb74936258742dd54260ad","original_commit_id":"ef98e04a57cb62a916cb74936258742dd54260ad","user":{"login":"kuldeepaggarwal","id":1930730,"avatar_url":"https://avatars.githubusercontent.com/u/1930730?v=3","gravatar_id":"","url":"https://api.github.com/users/kuldeepaggarwal","html_url":"https://github.com/kuldeepaggarwal","followers_url":"https://api.github.com/users/kuldeepaggarwal/followers","following_url":"https://api.github.com/users/kuldeepaggarwal/following{/other_user}","gists_url":"https://api.github.com/users/kuldeepaggarwal/gists{/gist_id}","starred_url":"https://api.github.com/users/kuldeepaggarwal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuldeepaggarwal/subscriptions","organizations_url":"https://api.github.com/users/kuldeepaggarwal/orgs","repos_url":"https://api.github.com/users/kuldeepaggarwal/repos","events_url":"https://api.github.com/users/kuldeepaggarwal/events{/privacy}","received_events_url":"https://api.github.com/users/kuldeepaggarwal/received_events","type":"User","site_admin":false},"body":"migration_file =  Dir.glob(\"#{ActiveRecord::Migrator.migrations_path}/*#{ current_version  }*.rb\").first","created_at":"2015-03-26T07:37:34Z","updated_at":"2015-03-26T07:37:34Z","html_url":"https://github.com/rails/rails/pull/19367#discussion_r27192944","pull_request_url":"https://api.github.com/repos/rails/rails/pulls/19367","_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/27192944"},"html":{"href":"https://github.com/rails/rails/pull/19367#discussion_r27192944"},"pull_request":{"href":"https://api.github.com/repos/rails/rails/pulls/19367"}}},"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/19367","id":31303250,"html_url":"https://github.com/rails/rails/pull/19367","diff_url":"https://github.com/rails/rails/pull/19367.diff","patch_url":"https://github.com/rails/rails/pull/19367.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/19367","number":19367,"state":"open","locked":false,"title":"Print the migration file of current schema version number.","user":{"login":"JuanitoFatas","id":1000669,"avatar_url":"https://avatars.githubusercontent.com/u/1000669?v=3","gravatar_id":"","url":"https://api.github.com/users/JuanitoFatas","html_url":"https://github.com/JuanitoFatas","followers_url":"https://api.github.com/users/JuanitoFatas/followers","following_url":"https://api.github.com/users/JuanitoFatas/following{/other_user}","gists_url":"https://api.github.com/users/JuanitoFatas/gists{/gist_id}","starred_url":"https://api.github.com/users/JuanitoFatas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuanitoFatas/subscriptions","organizations_url":"https://api.github.com/users/JuanitoFatas/orgs","repos_url":"https://api.github.com/users/JuanitoFatas/repos","events_url":"https://api.github.com/users/JuanitoFatas/events{/privacy}","received_events_url":"https://api.github.com/users/JuanitoFatas/received_events","type":"User","site_admin":false},"body":"Hello there,\r\n\r\nI use `rake db:version` to debug migration error. And the current behaviour is to print the version number of schema: \r\n\r\n```Shell\r\n$ rake db:version\r\nCurrent version: 20150316153147\r\n```\r\n\r\nThen I use this number to find the migration file and fix the migration error.\r\n\r\nThis pull request will print the migration file path, then one can click on Terminal or copy this path to quickly open the migration file.\r\n\r\n```\r\n$ rake db:version\r\nCurrent version: /Users/Juan/dev/rails-4-2/db/migrate/20150316153147_rename_columns_of_users.rb.\r\n```\r\n\r\nHope this make  `rake db:version` a little bit better.\r\n","created_at":"2015-03-17T02:47:03Z","updated_at":"2015-03-26T07:37:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"61866ccbb1671b57a5c4e7907485e6f42a3b597a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rails/rails/pulls/19367/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/19367/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails/rails/issues/19367/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/ef98e04a57cb62a916cb74936258742dd54260ad","head":{"label":"JuanitoFatas:feature/rake-db-version","ref":"feature/rake-db-version","sha":"ef98e04a57cb62a916cb74936258742dd54260ad","user":{"login":"JuanitoFatas","id":1000669,"avatar_url":"https://avatars.githubusercontent.com/u/1000669?v=3","gravatar_id":"","url":"https://api.github.com/users/JuanitoFatas","html_url":"https://github.com/JuanitoFatas","followers_url":"https://api.github.com/users/JuanitoFatas/followers","following_url":"https://api.github.com/users/JuanitoFatas/following{/other_user}","gists_url":"https://api.github.com/users/JuanitoFatas/gists{/gist_id}","starred_url":"https://api.github.com/users/JuanitoFatas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuanitoFatas/subscriptions","organizations_url":"https://api.github.com/users/JuanitoFatas/orgs","repos_url":"https://api.github.com/users/JuanitoFatas/repos","events_url":"https://api.github.com/users/JuanitoFatas/events{/privacy}","received_events_url":"https://api.github.com/users/JuanitoFatas/received_events","type":"User","site_admin":false},"repo":{"id":12693746,"name":"rails","full_name":"JuanitoFatas/rails","owner":{"login":"JuanitoFatas","id":1000669,"avatar_url":"https://avatars.githubusercontent.com/u/1000669?v=3","gravatar_id":"","url":"https://api.github.com/users/JuanitoFatas","html_url":"https://github.com/JuanitoFatas","followers_url":"https://api.github.com/users/JuanitoFatas/followers","following_url":"https://api.github.com/users/JuanitoFatas/following{/other_user}","gists_url":"https://api.github.com/users/JuanitoFatas/gists{/gist_id}","starred_url":"https://api.github.com/users/JuanitoFatas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuanitoFatas/subscriptions","organizations_url":"https://api.github.com/users/JuanitoFatas/orgs","repos_url":"https://api.github.com/users/JuanitoFatas/repos","events_url":"https://api.github.com/users/JuanitoFatas/events{/privacy}","received_events_url":"https://api.github.com/users/JuanitoFatas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JuanitoFatas/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/JuanitoFatas/rails","forks_url":"https://api.github.com/repos/JuanitoFatas/rails/forks","keys_url":"https://api.github.com/repos/JuanitoFatas/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuanitoFatas/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuanitoFatas/rails/teams","hooks_url":"https://api.github.com/repos/JuanitoFatas/rails/hooks","issue_events_url":"https://api.github.com/repos/JuanitoFatas/rails/issues/events{/number}","events_url":"https://api.github.com/repos/JuanitoFatas/rails/events","assignees_url":"https://api.github.com/repos/JuanitoFatas/rails/assignees{/user}","branches_url":"https://api.github.com/repos/JuanitoFatas/rails/branches{/branch}","tags_url":"https://api.github.com/repos/JuanitoFatas/rails/tags","blobs_url":"https://api.github.com/repos/JuanitoFatas/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuanitoFatas/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuanitoFatas/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuanitoFatas/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuanitoFatas/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/JuanitoFatas/rails/languages","stargazers_url":"https://api.github.com/repos/JuanitoFatas/rails/stargazers","contributors_url":"https://api.github.com/repos/JuanitoFatas/rails/contributors","subscribers_url":"https://api.github.com/repos/JuanitoFatas/rails/subscribers","subscription_url":"https://api.github.com/repos/JuanitoFatas/rails/subscription","commits_url":"https://api.github.com/repos/JuanitoFatas/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuanitoFatas/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuanitoFatas/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuanitoFatas/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuanitoFatas/rails/contents/{+path}","compare_url":"https://api.github.com/repos/JuanitoFatas/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuanitoFatas/rails/merges","archive_url":"https://api.github.com/repos/JuanitoFatas/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuanitoFatas/rails/downloads","issues_url":"https://api.github.com/repos/JuanitoFatas/rails/issues{/number}","pulls_url":"https://api.github.com/repos/JuanitoFatas/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/JuanitoFatas/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/JuanitoFatas/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuanitoFatas/rails/labels{/name}","releases_url":"https://api.github.com/repos/JuanitoFatas/rails/releases{/id}","created_at":"2013-09-09T05:31:20Z","updated_at":"2015-03-02T15:37:30Z","pushed_at":"2015-03-19T11:57:04Z","git_url":"git://github.com/JuanitoFatas/rails.git","ssh_url":"git@github.com:JuanitoFatas/rails.git","clone_url":"https://github.com/JuanitoFatas/rails.git","svn_url":"https://github.com/JuanitoFatas/rails","homepage":"http://rubyonrails.org","size":123814,"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":"338d25083bafff24c285a141a0caa182a5c2b9ec","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-03-26T06:15:16Z","pushed_at":"2015-03-26T04:53:33Z","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":395813,"stargazers_count":25410,"watchers_count":25410,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":9983,"mirror_url":null,"open_issues_count":736,"forks":9983,"open_issues":736,"watchers":25410,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/19367"},"html":{"href":"https://github.com/rails/rails/pull/19367"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/19367"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/19367/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/19367/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/19367/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/ef98e04a57cb62a916cb74936258742dd54260ad"}}}}