0

I have a new app with psotgresql instead of sqlite3 and the command

db:migrate

is not working

Here is the full log with db:migrate --trace

    C:\Users\Jaiel\Desktop\Uebung_3_Elias_Kechter_s0555064_SoSe_2018_AI_Web_Entwicklung\order_management>rails db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
rails aborted!
PG::ConnectionBad: could not connect to server: Connection refused (0x0000274D/10061)
        Is the server running on host "localhost" (::1) and accepting
        TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
        Is the server running on host "localhost" (127.0.0.1) and accepting
        TCP/IP connections on port 5432?
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/pg-1.0.0-x86-mingw32/lib/pg.rb:56:in `initialize'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/pg-1.0.0-x86-mingw32/lib/pg.rb:56:in `new'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/pg-1.0.0-x86-mingw32/lib/pg.rb:56:in `connect'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:697:in `connect'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:221:in `initialize'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `new'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:38:in `postgresql_connection'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:759:in `new_connection'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:803:in `checkout_new_connection'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:782:in `try_to_checkout_new_connection'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:743:in `acquire_connection'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:500:in `checkout'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `connection'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `retrieve_connection'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/connection_handling.rb:116:in `retrieve_connection'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/connection_handling.rb:88:in `connection'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/schema_migration.rb:20:in `table_exists?'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/schema_migration.rb:24:in `create_table'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/migration.rb:1125:in `initialize'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/migration.rb:1007:in `new'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/migration.rb:1007:in `up'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/migration.rb:985:in `migrate'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/tasks/database_tasks.rb:171:in `migrate'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.1.6/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `block in execute'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `each'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:271:in `execute'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:193:in `invoke_with_call_chain'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/task.rb:182:in `invoke'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:160:in `invoke_task'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `each'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block in top_level'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:125:in `run_with_threads'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:110:in `top_level'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.6/lib/rails/commands/rake/rake_command.rb:21:in `block in perform'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.6/lib/rails/commands/rake/rake_command.rb:18:in `perform'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.6/lib/rails/command.rb:46:in `invoke'
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.6/lib/rails/commands.rb:16:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:migrate

I havent found any solution and im sad because it actuylla works with sqlite3 but I need to have postgresql for Heroku deployment...

3
  • add pg on production group only Commented May 9, 2018 at 12:43
  • 1
    Did you try installing postgresql locally? What was the result? Commented May 9, 2018 at 12:46
  • Do you have postgres? If not you can just download it from their website (it's free) Commented May 9, 2018 at 15:10

1 Answer 1

3

Maybe this will help you: postgreSQL database service

As mentioned in the answer (user: ontrack) below

Use services (start -> run -> services.msc) and look for the postgresql-[version] service.

  • If it is not there you might have just installed pgAdmin and not installed PostgreSQL itself.
  • If it is not running try to start it, if it won't start open the event-viewer (start -> run -> eventvwr) and look for error messages relating to the PostgreSQL service.
  • If it does start check the startup type, if you want it to start with windows it should be "Automatic"; or perhaps "Automatic, delayed start" if you don't want it to slow down startup too much.

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.