sgruhier/capistrano-db-tasks

db:push fails silently

Opened this issue · 2 comments

I've pushed my db up using "cap staging db:push" to the staging server, and all the commands look as if they're succeeding, but it seems like it's failing silently, somewhere. When I run a rails console or go to the staging site, the data isn't uploaded. I also restarted the web service to see if that helped, but it did not. Any ideas? Here's the feedback I get when I run "cap staging db:push". Anything wrong here?

local {"adapter"=>"postgresql", "encoding"=>"unicode", "database"=>"example_website_development", "host"=>"localhost", "pool"=>5, "min_messages"=>"WARNING", "username"=>"MyLocalUsername"}
INFO Uploading db/example_website_development_2015-03-24-170745.sql.bz2 61.86%
INFO Uploading db/example_website_development_2015-03-24-170745.sql.bz2 100.0%
INFO [5482fc3a] Running /usr/bin/env cd /home/example_website/public_html/examplewebsite.hostname.com/current && bunzip2 -f db/example_website_development_2015-03-24-170745.sql.bz2 && RAILS_ENV=staging && PGPASSWORD='databasepassword' psql -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'example_website_staging' AND pid <> pg_backend_pid();;"  -U example_website ; PGPASSWORD='databasepassword' dropdb  -U example_website  example_website_staging; PGPASSWORD='databasepassword' createdb  -U example_website  example_website_staging; PGPASSWORD='databasepassword' psql  -U example_website  -d example_website_staging < db/example_website_development_2015-03-24-170745.sql as example_website@hostname.com
INFO [5482fc3a] Finished in 5.441 seconds with exit status 0 (successful).
INFO [d5236471] Running /usr/bin/env cd /home/example_website/public_html/examplewebsite.hostname.com/current && rm db/example_website_development_2015-03-24-170745.sql as example_website@hostname.com
INFO [d5236471] Finished in 0.106 seconds with exit status 0 (successful).

@hallmatt can you run cap --backtrace staging db:push?

Same here. You can reproduce by running db:push on PostgreSQL db with credentials that doesn't have permission to drop/create database. It fails silently without any notice even with --backtrace