{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/26319","repository_url":"https://api.github.com/repos/rails/rails","labels_url":"https://api.github.com/repos/rails/rails/issues/26319/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/26319/comments","events_url":"https://api.github.com/repos/rails/rails/issues/26319/events","html_url":"https://github.com/rails/rails/issues/26319","id":173822843,"number":26319,"title":"Database drop task loads route file","user":{"login":"Hugo-Hache","id":5188983,"avatar_url":"https://avatars.githubusercontent.com/u/5188983?v=3","gravatar_id":"","url":"https://api.github.com/users/Hugo-Hache","html_url":"https://github.com/Hugo-Hache","followers_url":"https://api.github.com/users/Hugo-Hache/followers","following_url":"https://api.github.com/users/Hugo-Hache/following{/other_user}","gists_url":"https://api.github.com/users/Hugo-Hache/gists{/gist_id}","starred_url":"https://api.github.com/users/Hugo-Hache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hugo-Hache/subscriptions","organizations_url":"https://api.github.com/users/Hugo-Hache/orgs","repos_url":"https://api.github.com/users/Hugo-Hache/repos","events_url":"https://api.github.com/users/Hugo-Hache/events{/privacy}","received_events_url":"https://api.github.com/users/Hugo-Hache/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/railties","name":"railties","color":"8BE06E"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-29T17:07:46Z","updated_at":"2016-09-02T09:13:23Z","closed_at":"2016-09-02T08:34:56Z","body":"### Steps to reproduce\r\n\r\n1. Create a Rails 5 project\r\n2. Insert a log in config/routes.rb\r\n3. Run `bundle exec rails db:drop`\r\n4. See you log waving at you in the terminal\r\n\r\n### Expected behavior\r\nPrior to version 5 route file was not loaded when using `bundle exec rake db:drop`\r\n### Actual behavior\r\nRoute file is loaded when db:drop command runs `bundle exec rails db:drop`\r\n\r\n### Why is it problematic ?\r\nSome gem, as Devise, loads model in route file, and some logic in the model may try to execute database calls. If the database does not exist, which might be the case when running db:drop, the command will crash. \r\nIt would have been much more problematic if it was also the case in database create task, but surprisingly the create task does not load the route file. \r\n\r\n### System configuration\r\n**Rails version**: 5.0.0.1\r\n\r\n**Ruby version**: 2.3.1\r\n"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/244324610","html_url":"https://github.com/rails/rails/issues/26319#issuecomment-244324610","issue_url":"https://api.github.com/repos/rails/rails/issues/26319","id":244324610,"user":{"login":"Hugo-Hache","id":5188983,"avatar_url":"https://avatars.githubusercontent.com/u/5188983?v=3","gravatar_id":"","url":"https://api.github.com/users/Hugo-Hache","html_url":"https://github.com/Hugo-Hache","followers_url":"https://api.github.com/users/Hugo-Hache/followers","following_url":"https://api.github.com/users/Hugo-Hache/following{/other_user}","gists_url":"https://api.github.com/users/Hugo-Hache/gists{/gist_id}","starred_url":"https://api.github.com/users/Hugo-Hache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hugo-Hache/subscriptions","organizations_url":"https://api.github.com/users/Hugo-Hache/orgs","repos_url":"https://api.github.com/users/Hugo-Hache/repos","events_url":"https://api.github.com/users/Hugo-Hache/events{/privacy}","received_events_url":"https://api.github.com/users/Hugo-Hache/received_events","type":"User","site_admin":false},"created_at":"2016-09-02T09:13:23Z","updated_at":"2016-09-02T09:13:23Z","body":"It crashes only when you run db:drop and the database does not exist. I stated it in my issue description: \r\n\r\n> If the database does not exist, which might be the case when running db:drop, the command will crash.\r\n\r\nIf I stick with your workflow, adding one last db:drop triggers the crash:\r\n\r\n```\r\nbe rake db:create\r\nbe rake db:migrate\r\nbe rake db:drop\r\nbe rake db:drop\r\n```"}}
{"actor":{"display_login":"Hugo-Hache"}}