rake aborted! PG::UndefinedTable: ERROR: relation "pages" does not exist

jfdimark

I need help debugging an error I'm having in deploying my Rails 4 app to heroku following a fork to create a staging environment.

During compiling, I get the error:

rake aborted!
       PG::UndefinedTable: ERROR:  relation "pages" does not exist

I've run the command to reset the database:

    heroku pg:reset DATABASE_URL --confirm welivecontent-staging
Resetting HEROKU_POSTGRESQL_COBALT_URL (DATABASE_URL)... done

I then run (with trace so you can see results):

heroku run rake db:migrate --app welivecontent-staging --trace
Running `rake db:migrate --trace` attached to terminal... up, run.9204
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
** Invoke db:_dump (first_time)
** Execute db:_dump
** Invoke db:schema:dump (first_time)
** Invoke environment 
** Invoke db:load_config 
** Execute db:schema:dump
marks-mbp-2:wlc markwalker$ 

heroku restart --app welivecontent-staging
Restarting dynos... done

I then try to push again...and get the same error.

When I try heroku run rake db:setup --app welivecontent-staging I get the following error:

FATAL:  permission denied for database "postgres"
DETAIL:  User does not have CONNECT privilege.
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:831:in `initialize'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:831:in `new'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:831:in `connect'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:548:in `initialize'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `new'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `postgresql_connection'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:440:in `new_connection'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:450:in `checkout_new_connection'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:421:in `acquire_connection'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:356:in `block in checkout'
/app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `checkout'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
/app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve_connection'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_handling.rb:79:in `retrieve_connection'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/connection_handling.rb:53:in `connection'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/tasks/postgresql_database_tasks.rb:8:in `connection'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/tasks/postgresql_database_tasks.rb:17:in `create'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/tasks/database_tasks.rb:73:in `create'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/tasks/database_tasks.rb:93:in `create_database_url'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.1/lib/active_record/railties/databases.rake:18:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:236:in `call'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:236:in `block in execute'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:231:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:197:in `block in invoke_prerequisites'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:195:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:195:in `invoke_prerequisites'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:174:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:197:in `block in invoke_prerequisites'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:195:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:195:in `invoke_prerequisites'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:174:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:149:in `invoke_task'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:106:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:106:in `block in top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:115:in `run_with_threads'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:100:in `top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:78:in `block in run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `load'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `<main>'
Couldn't create database for {"adapter"=>"postgresql", "username"=>"sometext", "password"=>"sometext", "port"=>5432, "database"=>"sometext", "host"=>"sometext.compute-1.amazonaws.com"}
/app/db/schema.rb doesn't exist yet. Run `rake db:migrate` to create it, then try again. If you do not intend to use a database, you should instead alter /app/config/application.rb to limit the frameworks that will be loaded.

It might be worth mentioning I have definitely migrated and pushed all migrations to the master branch; and that I am using delayed_job and foreman in the my app (as they may be involved in the issue somehow). I also cannot push to heroku master now as I get the same error.

I'd really appreciate any pointers on this as I'm going round and round in circles.

UPDATE:

I've destroyed both heroku apps, and then recreated a new one, but the error still happened.

I then verified if there was a wlc_production database by running psql - it said there wasn't, so I created one using createdb wlc_production and verified that it was created.

Next I tried RAILS_ENV=production bundle exec rake assets:precompile to test if it compiles locally, and received the same error PG::UndefinedTable: ERROR: relation "pages" does not exist, so I tried to migrate the database with heroku run rake db:migrate and got a new error:

rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/usr/local/lib/ruby/1.9.1/rake.rb:2367:in `raw_load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/usr/local/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:1991:in `run'

So i figured maybe I didn't have a Rakefile (I do) or that my ruby version is not up-to-date, but I confirmed that I'm using my default ruby version 2.0.0p353. To be sure my gems are also using this, I did rvm gemset create 2.0.0p353 wlc and created then defaulted this new gemset, and ran bundle install.

I committed my changes...and still nothing.

If I run git push heroku master I run into the error:

could not connect to server: Connection refused
       Is the server running on host "127.0.0.1" and accepting

If I try heroku run rake db:migrate, I get the error: No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)

Running rake db:schema:load doesn't create an error, I get the following:

-- enable_extension("plpgsql")
   -> 0.0175s
-- enable_extension("hstore")
   -> 0.0027s
-- create_table("active_admin_comments", {:force=>true})
   -> 0.4491s
.........
-- initialize_schema_migrations_table()
   -> 0.0450s

but neither does it help stop the errors/solve the problem. Again, any pointers/suggestions/help based on update info very much appreciated.

jfdimark

In the end, dropping the 'pages' table and recreating it with a fresh migration solved the issue. No idea why.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

rake aborted! PG::UndefinedTable: ERROR: relation "pages" does not exist

From Dev

Rails: PG::UndefinedTable: ERROR: relation "..." does not exist

From Dev

PG::UndefinedTable: ERROR: relation does not exist

From Dev

PG::UndefinedTable: ERROR: relation "musicians" does not exist

From Dev

PG::UndefinedTable: ERROR: relation 'caves' does not exist

From Dev

ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "guestbooks" does not exist

From Dev

ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "spree_orders" does not exist

From Dev

heroku postgresql database rails app PG::UndefinedTable: ERROR: relation "comments" does not exist

From Dev

PG::UndefinedTable: ERROR: relation "" does not exist - Amazon EC2, Postgresql, and Rails 5

From Dev

PG::UndefinedTable: ERROR: table "table-name" does not exist

From Dev

rake aborted! for uninitialized constant that does exist

From Dev

pg_restore ERROR: “Relation does not exist” and creating new database

From Dev

Rake db:migrate error 'PG::UndefinedColumn: ERROR: column "slug" does not exist'

From Dev

i18n-active_record PG::Error: ERROR: relation "translations" does not exist (rails 4)

From Dev

i18n-active_record PG::Error: ERROR: relation "translations" does not exist (rails 4)

From Dev

Pg:Error column does not exist

From Dev

PG::UndefinedColumn: ERROR: column "city_id" of relation "events" does not exist

From Dev

JPA ERROR: relation does not exist

From Dev

Relation does not exist error using WITH

From Dev

heroku rake migrate db error relation "post" doesn't exist

From Dev

Rake Aborted syntax error Ruby

From Dev

Heroku database error on production: PG::UndefinedTable Error

From Dev

Sidekiq PG::UndefinedColumn: ERROR: does not exist

From Dev

Django + posgtres relation does not exist error

From Dev

Redshift ERROR: relation "Temp table" does not exist

From Dev

PostgreSQL: Error: column of relation does not exist

From Dev

Error : relation does not exist, on greenplum database

From Dev

PSQLException: ERROR: relation "folder" does not exist

From Dev

"relation does not seem to exist" error on Heroku

Related Related

  1. 1

    rake aborted! PG::UndefinedTable: ERROR: relation "pages" does not exist

  2. 2

    Rails: PG::UndefinedTable: ERROR: relation "..." does not exist

  3. 3

    PG::UndefinedTable: ERROR: relation does not exist

  4. 4

    PG::UndefinedTable: ERROR: relation "musicians" does not exist

  5. 5

    PG::UndefinedTable: ERROR: relation 'caves' does not exist

  6. 6

    ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "guestbooks" does not exist

  7. 7

    ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "spree_orders" does not exist

  8. 8

    heroku postgresql database rails app PG::UndefinedTable: ERROR: relation "comments" does not exist

  9. 9

    PG::UndefinedTable: ERROR: relation "" does not exist - Amazon EC2, Postgresql, and Rails 5

  10. 10

    PG::UndefinedTable: ERROR: table "table-name" does not exist

  11. 11

    rake aborted! for uninitialized constant that does exist

  12. 12

    pg_restore ERROR: “Relation does not exist” and creating new database

  13. 13

    Rake db:migrate error 'PG::UndefinedColumn: ERROR: column "slug" does not exist'

  14. 14

    i18n-active_record PG::Error: ERROR: relation "translations" does not exist (rails 4)

  15. 15

    i18n-active_record PG::Error: ERROR: relation "translations" does not exist (rails 4)

  16. 16

    Pg:Error column does not exist

  17. 17

    PG::UndefinedColumn: ERROR: column "city_id" of relation "events" does not exist

  18. 18

    JPA ERROR: relation does not exist

  19. 19

    Relation does not exist error using WITH

  20. 20

    heroku rake migrate db error relation "post" doesn't exist

  21. 21

    Rake Aborted syntax error Ruby

  22. 22

    Heroku database error on production: PG::UndefinedTable Error

  23. 23

    Sidekiq PG::UndefinedColumn: ERROR: does not exist

  24. 24

    Django + posgtres relation does not exist error

  25. 25

    Redshift ERROR: relation "Temp table" does not exist

  26. 26

    PostgreSQL: Error: column of relation does not exist

  27. 27

    Error : relation does not exist, on greenplum database

  28. 28

    PSQLException: ERROR: relation "folder" does not exist

  29. 29

    "relation does not seem to exist" error on Heroku

HotTag

Archive