Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

As I mentioned in the title, I am using a PostgreSQL database on Ruby on Rails since heroku doesn't support MySQLite anymore. After I ran the command rails generate scaffold User name:string email:string everything went smoothly, but when I tried rake db:migrate it throwed some errors. After searching for a while I downgraded Rake from 10.0.1 to 0.8.7. This is the error I get using --trace:

> /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake/alt_system.rb:32:
> Use RbConfig instead of obsolete and deprecated Config. (in
> /home/Roma/rails_projects/coise)
> ** Invoke db:migrate (first_time)
> ** Invoke environment (first_time)
> ** Execute environment
> ** Execute db:migrate rake aborted! could not connect to server: Connection refused
>         Is the server running on host "localhost" (127.0.0.1) and accepting
>         TCP/IP connections on port 5432? /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:928:in `initialize'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:928:in `new'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:928:in `connect'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:228:in `initialize'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:25:in
> `new'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:25:in
> `postgresql_connection'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:230:in
> `new_connection'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:238:in
> `checkout_new_connection'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:194:in
> `block (2 levels) in checkout'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in
> `loop'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in
> `block in checkout' /usr/lib/ruby/1.9.1/monitor.rb:211:in
> `mon_synchronize'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:189:in
> `checkout'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:96:in
> `connection'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:318:in
> `retrieve_connection'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:97:in `retrieve_connection'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in `connection'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/migration.rb:486:in
> `initialize'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/migration.rb:433:in
> `new'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/migration.rb:433:in
> `up'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/migration.rb:415:in
> `migrate'
> /usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.1/lib/active_record/railties/databases.rake:142:in
> `block (2 levels) in <top (required)>'
> /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `call'
> /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `block in
> execute' /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in
> `each' /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in
> `execute' /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:597:in
> `block in invoke_with_call_chain'
> /usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
> /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in
> `invoke_with_call_chain'
> /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
> /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2051:in
> `invoke_task'
> /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2
> levels) in top_level'
> /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
> /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block in
> top_level'
> /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in
> `standard_exception_handling'
> /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2023:in
> `top_level'
> /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2001:in `block in
> run' /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in
> `standard_exception_handling'
> /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
> /usr/lib/ruby/gems/1.9.1/gems/rake-0.8.7/bin/rake:31:in `<top
> (required)>' /usr/bin/rake:23:in `load' /usr/bin/rake:23:in `<main>'

I am really clueless of what to do now. I will also present my database.yml file (with some changes I made from the tips I encountered while searching) :

development:
  adapter: postgresql
  encoding: unicode
  database: coise_development
  pool: 5
  username: coise
  password:
  host: localhost
  port: 5432

test:
  adapter: postgresql
  encoding: unicode
  database: coise_test
  pool: 5
  username: coise
  password:
  host: localhost
  port: 5432

production:
  adapter: postgresql
  encoding: unicode
  database: coise_production
  pool: 5
  username: coise
  password:
share|improve this question
    
Is your posgresql server running? in linux you can start it using the command sudo service postgresql start –  Vimsha Dec 10 '13 at 20:21
    
My machine is a Windows 7 but I am running Cygwin, I will try that. –  Nuno Roma Dec 10 '13 at 20:24
    
As I thought. Service doesn't work on Cygwin. I'm sure I installed PostGreSQL using the Cygwin instalation, I just don't know how to run its commands... –  Nuno Roma Dec 10 '13 at 20:35

1 Answer 1

I have made progress. I was able, by this StackOverflow post - Enable Postgresql in Cygwin - to get my PostGreSql service up and running. In the end, all I had to do was change my database.yml file username and database fields according to the user on wich PostGreSql service started, in my case was "Roma".

Finally, the command rake db:migrate encountered no problems, just like my push to heroku did, flawless. The only thing I still don't understand lays on the heroku hosting, as my Users page (the table I added by using the Rails scaffold command) isn't available yet. My heroku tells me I should have more "Dynos" and upgrade to a "Production Postgresql Database". I'm not sure if this means that it will take a while for the hosting to complete or if there is actually anything wrong with my app, though I have to say that the database generated is really basic and simple. If any moderator thinks this should be turned into a new StackOverflow post, please let me know.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.