pvskisteak5
pvskisteak5

Reputation: 4262

database.yml file configuration and postgres - rake db:drop db:create db:migrate

I recently switched to postgres for a rails app in development since I deployed on Heroku and want to match production. Postgres is installed and working correctly for my application when I set the database name equal to 'postgres', which is the default name from what I understand.

However, I would like to change the database name for development, test and production. If I simply change the names in database.yml, and try to run a rake task, I get the following error in my terminal:

NOTICE:  database "something_development" does not exist, skipping
Couldn't drop something_test : #<PG::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"?>
rake aborted!
FATAL:  database "something_development" does not exist

Here is what my database.yml file currently looks:

development:
  adapter: postgresql
  host: localhost
  database: something_development

  username: name


test:
  adapter: postgresql
  database: something_test
  pool: 5
  timeout: 5000

production:
  adapter: postgresql
  host: localhost
  username: name
  database: something_production

Are there some other steps I am missing? Apologies if I am missing something obvious here! Thanks!

Upvotes: 4

Views: 5521

Answers (1)

Brad Werth
Brad Werth

Reputation: 17647

Changing the name in the database.yml file only changes the place that it looks for the database, it does not actually rename the database itself. If you change the specified location, you will need to rename the database to match, using a GUI tool (like navicat or pgadmin) or the command line.

Also, it is probably an obfuscation omission, but your posted output refers to both shredset_development and something_development. If this continues to fail, perhaps verify that all of your names are the same everywhere...

Upvotes: 3

Related Questions