{"action":"closed","issue":{"url":"https://api.github.com/repos/lotus/model/issues/250","labels_url":"https://api.github.com/repos/lotus/model/issues/250/labels{/name}","comments_url":"https://api.github.com/repos/lotus/model/issues/250/comments","events_url":"https://api.github.com/repos/lotus/model/issues/250/events","html_url":"https://github.com/lotus/model/issues/250","id":111342810,"number":250,"title":"Improve error message for `lotus db drop`","user":{"login":"jodosha","id":5089,"avatar_url":"https://avatars.githubusercontent.com/u/5089?v=3","gravatar_id":"","url":"https://api.github.com/users/jodosha","html_url":"https://github.com/jodosha","followers_url":"https://api.github.com/users/jodosha/followers","following_url":"https://api.github.com/users/jodosha/following{/other_user}","gists_url":"https://api.github.com/users/jodosha/gists{/gist_id}","starred_url":"https://api.github.com/users/jodosha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jodosha/subscriptions","organizations_url":"https://api.github.com/users/jodosha/orgs","repos_url":"https://api.github.com/users/jodosha/repos","events_url":"https://api.github.com/users/jodosha/events{/privacy}","received_events_url":"https://api.github.com/users/jodosha/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/lotus/model/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/lotus/model/labels/help-wanted","name":"help-wanted","color":"009800"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/lotus/model/milestones/11","html_url":"https://github.com/lotus/model/milestones/v0.6.0","labels_url":"https://api.github.com/repos/lotus/model/milestones/11/labels","id":1330838,"number":11,"title":"v0.6.0","description":"","creator":{"login":"jodosha","id":5089,"avatar_url":"https://avatars.githubusercontent.com/u/5089?v=3","gravatar_id":"","url":"https://api.github.com/users/jodosha","html_url":"https://github.com/jodosha","followers_url":"https://api.github.com/users/jodosha/followers","following_url":"https://api.github.com/users/jodosha/following{/other_user}","gists_url":"https://api.github.com/users/jodosha/gists{/gist_id}","starred_url":"https://api.github.com/users/jodosha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jodosha/subscriptions","organizations_url":"https://api.github.com/users/jodosha/orgs","repos_url":"https://api.github.com/users/jodosha/repos","events_url":"https://api.github.com/users/jodosha/events{/privacy}","received_events_url":"https://api.github.com/users/jodosha/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":5,"state":"open","created_at":"2015-09-30T10:23:08Z","updated_at":"2015-10-21T07:50:18Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-10-14T07:47:21Z","updated_at":"2015-10-21T07:50:18Z","closed_at":"2015-10-21T07:50:18Z","body":"Steps to reproduce.\r\n\r\n```shell\r\n% lotus new bookshelf --database=postgres && cd bookshelf && bundle\r\n% bundle exec lotus db prepare\r\n```\r\n\r\nOpen another shell and left open the PG client\r\n\r\n```shell\r\n% psql bookshelf_development\r\n```\r\n\r\nGet back to the initial shell:\r\n\r\n```shell\r\n% bundle exec lotus db drop\r\n/Users/luca/.gem/ruby/2.2.3/gems/lotus-model-0.5.0/lib/lotus/model/migrator/postgres_adapter.rb:51:in `block in drop': Lotus::Model::MigrationError (Lotus::Model::MigrationError)\r\n        from /Users/luca/.rubies/ruby-2.2.3/lib/ruby/2.2.0/open3.rb:199:in `popen_run'\r\n        from /Users/luca/.rubies/ruby-2.2.3/lib/ruby/2.2.0/open3.rb:93:in `popen3'\r\n        from /Users/luca/.gem/ruby/2.2.3/gems/lotus-model-0.5.0/lib/lotus/model/migrator/postgres_adapter.rb:39:in `drop'\r\n        from /Users/luca/.gem/ruby/2.2.3/gems/lotus-model-0.5.0/lib/lotus/model/migrator.rb:112:in `drop'\r\n        from /Users/luca/.gem/ruby/2.2.3/gems/lotusrb-0.5.0/lib/lotus/commands/db/drop.rb:9:in `start'\r\n        from /Users/luca/.gem/ruby/2.2.3/gems/lotusrb-0.5.0/lib/lotus/commands/db.rb:46:in `drop'\r\n        from /Users/luca/.gem/ruby/2.2.3/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'\r\n        from /Users/luca/.gem/ruby/2.2.3/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'\r\n        from /Users/luca/.gem/ruby/2.2.3/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'\r\n        from /Users/luca/.gem/ruby/2.2.3/gems/thor-0.19.1/lib/thor/invocation.rb:115:in `invoke'\r\n        from /Users/luca/.gem/ruby/2.2.3/gems/thor-0.19.1/lib/thor.rb:235:in `block in subcommand'\r\n        from /Users/luca/.gem/ruby/2.2.3/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'\r\n        from /Users/luca/.gem/ruby/2.2.3/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'\r\n        from /Users/luca/.gem/ruby/2.2.3/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'\r\n        from /Users/luca/.gem/ruby/2.2.3/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'\r\n        from /Users/luca/.gem/ruby/2.2.3/gems/lotusrb-0.5.0/bin/lotus:4:in `<top (required)>'\r\n        from /Users/luca/.gem/ruby/2.2.3/bin/lotus:23:in `load'\r\n        from /Users/luca/.gem/ruby/2.2.3/bin/lotus:23:in `<main>'\r\n```\r\n\r\nThe reason is that `dropdb` fails, because we forgot the other shell open with a connected client. The problem is that we don't see any help in the error message.\r\n\r\nFor instance if I try with `dropdb` I see the problem and how to fix it.\r\n\r\n```shell\r\n% dropdb bookshelf_development\r\ndropdb: database removal failed: ERROR:  database \"bookshelf_development\" is being accessed by other users\r\nDETAIL:  There is 1 other session using the database.\r\n```"}}