Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgresql db:push doesn't create tables #25

Closed
mdpatrick opened this issue Mar 27, 2014 · 2 comments
Closed

Postgresql db:push doesn't create tables #25

mdpatrick opened this issue Mar 27, 2014 · 2 comments

Comments

@mdpatrick
Copy link
Contributor

Hey guys! Really glad this got updated for capistrano 3. Strangely, I've noticed that I have to run db migrations on my production server in order to get db:push. I would assume by the phrasing on the prompt that it would completely replace the database, but this doesn't appear to be the case.

I'll paste my error message below (pre-migration run):

DEBUG Uploading db/myapp_2014-03-26-172151.sql.bz2 0.0%
 INFO Uploading db/myapp_2014-03-26-172151.sql.bz2 100.0%
 INFO [413f2fbf] Running /usr/bin/env cd /var/www/myapp.com/current && bunzip2 -f db/myapp_2014-03-26-172151.sql.bz2 && RAILS_ENV=production && PGPASSWORD='KLkkE32@pple' psql  -U myapp  -h localhost myapp < db/myapp_2014-03-26-172151.sql on myapp.com
DEBUG [413f2fbf] Command: cd /var/www/myapp.com/current && bunzip2 -f db/myapp_2014-03-26-172151.sql.bz2 && RAILS_ENV=production && PGPASSWORD='KLkkE32@pple' psql  -U myapp  -h localhost myapp < db/myapp_2014-03-26-172151.sql
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  index "users_properties" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  index "unique_schema_migrations" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  index "posts_properties" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  index "index_votes_on_voter_id_and_voter_type_and_vote_scope" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  index "index_votes_on_votable_id_and_votable_type_and_vote_scope" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  index "index_versions_on_item_type_and_item_id" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  index "index_users_on_reset_password_token" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  index "index_users_on_email" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  index "index_active_admin_comments_on_resource_type_and_resource_id" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  index "index_active_admin_comments_on_namespace" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  index "index_active_admin_comments_on_author_type_and_author_id" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  relation "public.votes" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  relation "public.versions" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  relation "public.users" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  relation "public.posts" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  relation "public.pages" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  relation "public.images" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  relation "public.attachments" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  relation "public.active_admin_comments" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  relation "public.votes" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  relation "public.versions" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  relation "public.users" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  relation "public.posts" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  relation "public.pages" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  relation "public.images" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  relation "public.attachments" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  relation "public.active_admin_comments" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  sequence "votes_id_seq" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  table "votes" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  sequence "versions_id_seq" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  table "versions" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  sequence "users_id_seq" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  table "users" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  table "schema_migrations" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  sequence "posts_id_seq" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  table "posts" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  sequence "pages_id_seq" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  table "pages" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  sequence "images_id_seq" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  table "images" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  sequence "attachments_id_seq" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  table "attachments" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  sequence "active_admin_comments_id_seq" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    DROP EXTENSION
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    DROP EXTENSION
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    DROP SCHEMA
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE SCHEMA
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    COMMENT
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE EXTENSION
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    COMMENT
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE EXTENSION
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    COMMENT
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    SET
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE SEQUENCE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER SEQUENCE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE SEQUENCE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER SEQUENCE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE SEQUENCE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER SEQUENCE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE SEQUENCE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER SEQUENCE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE SEQUENCE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER SEQUENCE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE SEQUENCE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER SEQUENCE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE SEQUENCE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER SEQUENCE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE SEQUENCE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER SEQUENCE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]     setval 
DEBUG [413f2fbf]    --------
DEBUG [413f2fbf]          1
DEBUG [413f2fbf]    (1 row)
DEBUG [413f2fbf]    
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]     setval 
DEBUG [413f2fbf]    --------
DEBUG [413f2fbf]          9
DEBUG [413f2fbf]    (1 row)
DEBUG [413f2fbf]    
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]     setval 
DEBUG [413f2fbf]    --------
DEBUG [413f2fbf]         10
DEBUG [413f2fbf]    (1 row)
DEBUG [413f2fbf]    
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]     setval 
DEBUG [413f2fbf]    --------
DEBUG [413f2fbf]          2
DEBUG [413f2fbf]    (1 row)
DEBUG [413f2fbf]    
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]     setval 
DEBUG [413f2fbf]    --------
DEBUG [413f2fbf]          1
DEBUG [413f2fbf]    (1 row)
DEBUG [413f2fbf]    
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]     setval 
DEBUG [413f2fbf]    --------
DEBUG [413f2fbf]          1
DEBUG [413f2fbf]    (1 row)
DEBUG [413f2fbf]    
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]     setval 
DEBUG [413f2fbf]    --------
DEBUG [413f2fbf]         13
DEBUG [413f2fbf]    (1 row)
DEBUG [413f2fbf]    
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]     setval 
DEBUG [413f2fbf]    --------
DEBUG [413f2fbf]          1
DEBUG [413f2fbf]    (1 row)
DEBUG [413f2fbf]    
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    ALTER TABLE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE INDEX
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE INDEX
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE INDEX
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE INDEX
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE INDEX
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE INDEX
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE INDEX
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE INDEX
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE INDEX
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE INDEX
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    CREATE INDEX
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    REVOKE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    REVOKE
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    GRANT
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
DEBUG [413f2fbf]    GRANT
DEBUG [413f2fbf]    ERROR:  table "active_admin_comments" does not exist
 INFO [413f2fbf] Finished in 0.513 seconds with exit status 0 (successful).
 INFO [6d375ef1] Running /usr/bin/env cd /var/www/myapp.com/current && rm db/myapp_2014-03-26-172151.sql on myapp.com
DEBUG [6d375ef1] Command: cd /var/www/myapp.com/current && rm db/myapp_2014-03-26-172151.sql
 INFO [6d375ef1] Finished in 0.203 seconds with exit status 0 (successful).

I hope this is just a bug that can be fixed, I was really looking forward to being able to take my local database and put it exactly as it exists on production.

@sgruhier
Copy link
Owner

I'm not an posgres expert at all, but on heroku the do

$ PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser mydb > mydb.dump

$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump

Could you try to modify the code to test it on your DB?
Thanks

@mdpatrick
Copy link
Contributor Author

see pr #26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants