Question

I have read several posts and watched the railscast on migrating from sqlite3 to pg and all of them seem to have conflicting settings and I have not seen anyone run into the error I'm getting. I have data locally that i do NOT care about. If it gets destroyed that's fine.

Here is what I have done.

Changed database.yml from this:

development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000

To this:

development:
adapter: postgresql
database: app_name_database
pool: 5
timeout: 5000

One thing I did notice about this file and some of the examples is that I do not have encoding, username, or password. Is this necessary?

I updated my gem file from this:

group :production do
 gem 'pg'
 gem 'rails_12factor'
end

group :development do
 gem 'sqlite3'
end

To this:

group :production do
 gem 'pg'
 gem 'rails_12factor'
end

group :development do
 gem 'pg'
end 

Following the instructions - the railscast says to rake db:create:all. However, when I run this I get the following error in console:

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"?

Any ideas on what I'm doing incorrectly? Are there rake tasks that need to be done before this?

Thanks

Was it helpful?

Solution

Have you started the Postgresql database ? This is how I start mine - pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start ?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top