{"action":"created","issue":{"url":"https://api.github.com/repos/lotus/model/issues/199","labels_url":"https://api.github.com/repos/lotus/model/issues/199/labels{/name}","comments_url":"https://api.github.com/repos/lotus/model/issues/199/comments","events_url":"https://api.github.com/repos/lotus/model/issues/199/events","html_url":"https://github.com/lotus/model/issues/199","id":91634321,"number":199,"title":"Invalid connection URI results in PG::ConnectionBad: FATAL: database error","user":{"login":"emilford","id":63003,"avatar_url":"https://avatars.githubusercontent.com/u/63003?v=3","gravatar_id":"","url":"https://api.github.com/users/emilford","html_url":"https://github.com/emilford","followers_url":"https://api.github.com/users/emilford/followers","following_url":"https://api.github.com/users/emilford/following{/other_user}","gists_url":"https://api.github.com/users/emilford/gists{/gist_id}","starred_url":"https://api.github.com/users/emilford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emilford/subscriptions","organizations_url":"https://api.github.com/users/emilford/orgs","repos_url":"https://api.github.com/users/emilford/repos","events_url":"https://api.github.com/users/emilford/events{/privacy}","received_events_url":"https://api.github.com/users/emilford/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-28T20:18:49Z","updated_at":"2015-06-28T20:56:50Z","closed_at":null,"body":"There seems to be a bug when running `lotus db create` and other db-related commands on a new application:\r\n\r\n`PG::ConnectionBad: FATAL:  database \"Eric\" does not exist (Sequel::DatabaseConnectionError)`\r\n\r\nI haven't had a chance to dig into it fully, but the problem seems to stem from the following method:\r\n\r\n```\r\n def new_connection\r\n  uri = URI.parse(@connection.uri)\r\n  scheme, userinfo, host, port = uri.select(:scheme, :userinfo, :host, :port)\r\n\r\n  uri  = \"#{ scheme }://\"\r\n  uri += \"#{ userinfo }@\" unless userinfo.nil?\r\n  uri += host\r\n  uri += \":#{ port }\" unless port.nil?\r\n\r\n  Sequel.connect(uri)\r\nend\r\n```\r\n\r\nIt looks like the concatenated `uri` string does not include a database name.  PG is attempting to use the default database `Eric` instead of the configured database name.  I was able to temporarily get around this bug by passing `@connection.uri` to `Sequel.connect`.\r\n\r\n/cc @nickcoyne"},"comment":{"url":"https://api.github.com/repos/lotus/model/issues/comments/116333493","html_url":"https://github.com/lotus/model/issues/199#issuecomment-116333493","issue_url":"https://api.github.com/repos/lotus/model/issues/199","id":116333493,"user":{"login":"emilford","id":63003,"avatar_url":"https://avatars.githubusercontent.com/u/63003?v=3","gravatar_id":"","url":"https://api.github.com/users/emilford","html_url":"https://github.com/emilford","followers_url":"https://api.github.com/users/emilford/followers","following_url":"https://api.github.com/users/emilford/following{/other_user}","gists_url":"https://api.github.com/users/emilford/gists{/gist_id}","starred_url":"https://api.github.com/users/emilford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emilford/subscriptions","organizations_url":"https://api.github.com/users/emilford/orgs","repos_url":"https://api.github.com/users/emilford/repos","events_url":"https://api.github.com/users/emilford/events{/privacy}","received_events_url":"https://api.github.com/users/emilford/received_events","type":"User","site_admin":false},"created_at":"2015-06-28T20:56:50Z","updated_at":"2015-06-28T20:56:50Z","body":"I think :point_up: might be right.  I've come across several posts/comments that mention creating the db via `createdb` as a prerequisite for Sequel."}}