4

I'm having trouble changing an existing app with SQLite3 to postgreSQL. I'm following this tutorial to convert SQLite3 to postgreSQL and deploy it to heroku: https://devcenter.heroku.com/articles/sqlite3#running-rails-on-postgres.

I removed gem 'sqlite3' and replaced with gem 'pg'. After modifying config/database.yml, I ran migration.

$rake db:create and $rake db:migrate resulted this error:

could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

Gemfile used in production:

gem 'rails_12factor'
gem 'thin'
gem 'pg'

Following is the errors I get when I run with the local server:

/usr/local/rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:825:in `initialize': could not connect to server: No such file or directory (PG::ConnectionBad)
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
1
  • 1
    Read the error message. Did you check the things it's telling you to check? Did you search for the error message? I'll bet you're probably on a Mac, too, in which case add "OS X" to that search, because it's a v.common issue for Mac users of PostgreSQL + Rails. Hard to help more because you didn't include your PostgreSQL version or how you installed PostgreSQL, or your OS and version. Commented Jan 16, 2014 at 7:53

1 Answer 1

5

It looks like you have not added a Heroku Postgres database to your Heroku account. When a database is configured, your application will connect to it. Without a database configured, it's falling back to looking for one locally.

If you do have a database configured, something is wrong with your Heroku environment preventing your database connection settings from being found.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.