1

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

2
  • Have you installed and configured PostgreSQL locally? Commented Jan 9, 2014 at 21:44
  • Yeah - psql --version is psql (PostgreSQL) 9.1.9 Commented Jan 9, 2014 at 21:48

1 Answer 1

1

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 ?

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

4 Comments

so you run from the command line: "pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start" and it starts your pg server?
Unlike SQLite which staarts automatically you need to start Postgresql, at least in developmetn, whenver you start work for the day. Further info postgresql.org/docs/9.1/static/server-start.html - Pierre
This was it. Railscasts failed to mention that. Make sure pg is started before rake db:create:all. thanks!
apologies comannd is - pg_ctl -D /usr/local/var/postgres stop -s -m fast 2- Also you can (I haven't done so) start the database as part of the autostart - see blog.willj.net/2011/05/31/…

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.