msjit / testcasedb

TestCaseDB - Web based test case management
MIT License
40 stars 18 forks source link

PG::UndefinedTable: ERROR: relation "settings" does not exist #18

Closed harshith30 closed 10 years ago

harshith30 commented 10 years ago

Hi, I'm getting the above error whenever i try to run rake assets:precompile.

   System Details : 
   Operating System -   Ubuntu 14.04 LTS
   rvm    -  rvm 1.25.27 (stable)
   ruby   -  ruby 1.9.3p547 (2014-05-14 revision 45962) [x86_64-linux]
   psql    -   psql (PostgreSQL) 9.3.4

  harshith@harshith-Inspiron-3520:~/testcasedb$ bundle exec rake assets:precompile 
  RAILS_ENV='production' --trace

  ** Invoke assets:precompile (first_time)
  ** Execute assets:precompile
  /home/harshith/.rvm/rubies/ruby-1.9.3-p547/bin/ruby /home/harshith/.rvm/gems 
 /ruby- 1.9.3-p547/bin/rake assets:precompile:all RAILS_ENV=production   
 RAILS_GROUPS=assets --trace

** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
rake aborted! 
PG::UndefinedTable: ERROR:  relation "settings" does not exist
LINE 5:           
                  WHERE a.attrelid = '"settings"'::regclass:             
                 SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                 pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
          FROM pg_attribute a LEFT JOIN pg_attrdef d
            ON a.attrelid = d.adrelid AND a.attnum = d.adnum
         WHERE a.attrelid = '"settings"'::regclass
           AND a.attnum > 0 AND NOT a.attisdropped
         ORDER BY a.attnum

        My Postgres database looks as follows

postres database


 My Git log has following information:

 commit 991377ccc4749d05927295ca9f537141906ec222
Author: Marc Joffe <mjoffe@msjit.ca>
Date:   Fri Jun 27 11:06:23 2014 -0400

Fix system when google auth is disabled

commit 96c776a5e23dc587330ee724ca63876d7abf11f9 Author: Marc Joffe mjoffe@msjit.ca Date: Thu Jun 26 10:32:55 2014 -0400

Google auth should be disabled by default

commit 86a6e7d29418e87a88132579b96105a0f90a17b4
Author: Marc Joffe <mjoffe@msjit.ca>
Date:   Sat Jun 14 17:04:51 2014 -0400

Minor tweak to omniauth settings

commit 7716cc2448b90374dd54d53d5faebe595feb4d71
Merge: abe1b1a 6fc5902
Author: joffems <mjoffe@msjit.ca>
Date:   Sat Jun 14 17:02:14 2014 -0400

What steps should i take to fix this issue, if there is need for any additional information i will provide them.

harshith

kirantpatil commented 10 years ago

Facing same issue here when we try to setup the testcasedb from master branch.

The error messages show it is clearly coming from omniauth related code or gem.

Error from terminal


kiran@jaihanuman:~/testcasedb$ bundle exec rake db:setup RAILS_ENV='production' tcdb_production already exists rake aborted! PG::UndefinedTable: ERROR: relation "settings" does not exist LINE 5: WHERE a.attrelid = '"settings"'::regclass ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"settings"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:1163:in exec' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:1163:inexec_no_cache' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:660:in block in exec_query' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract_adapter.rb:280:inblock in log' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.14/lib/active_support/notifications/instrumenter.rb:20:in instrument' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract_adapter.rb:275:inlog' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:659:in exec_query' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:1292:incolumn_definitions' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:855:in columns' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.14/lib/active_record/connection_adapters/schema_cache.rb:12:inblock in initialize' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.14/lib/active_record/model_schema.rb:229:in yield' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.14/lib/active_record/model_schema.rb:229:indefault' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.14/lib/active_record/model_schema.rb:229:in columns' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.14/lib/active_record/model_schema.rb:249:incolumn_names' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.14/lib/active_record/model_schema.rb:262:in column_methods_hash' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.14/lib/active_record/dynamic_matchers.rb:74:inall_attributes_exists?' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.14/lib/active_record/dynamic_matchers.rb:27:in method_missing' /home/kiran/testcasedb/config/initializers/omniauth.rb:2:inblock in <top (required)>' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in instance_eval' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:ininitialize' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/omniauth-1.1.3/lib/omniauth/builder.rb:7:in initialize' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.14/lib/action_dispatch/middleware/stack.rb:43:innew' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.14/lib/action_dispatch/middleware/stack.rb:43:in build' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.14/lib/action_dispatch/middleware/stack.rb:113:inblock in build' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.14/lib/action_dispatch/middleware/stack.rb:113:in each' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.14/lib/action_dispatch/middleware/stack.rb:113:ininject' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.14/lib/action_dispatch/middleware/stack.rb:113:in build' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/engine.rb:475:inapp' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/application/finisher.rb:31:in block in <module:Finisher>' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/initializable.rb:30:ininstance_exec' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/initializable.rb:30:in run' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/initializable.rb:55:inblock in run_initializers' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/initializable.rb:54:in each' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/initializable.rb:54:inrun_initializers' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/application.rb:136:in initialize!' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/railtie/configurable.rb:30:inmethod_missing' /home/kiran/testcasedb/config/environment.rb:5:in <top (required)>' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:inrequire' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in block in require' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:236:inload_dependency' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in require' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/application.rb:103:inrequire_environment!' /home/kiran/testcasedb/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks' Tasks: TOP => db:setup => db:schema:load_if_ruby => environment (See full trace by running task with --trace)

joffems commented 10 years ago

After creating the database, you need to migrate to the latest set of database changes.

Can you please try running, "bundle exec rake db:migration RAILS_ENV=production".

After that, you can try compiling assets again.

harshith30 commented 10 years ago

Hi,

   Tried it and was not able to migrate the db.

harshith@harshith-Inspiron-3520:~/testcasedb$ bundle exec rake db:migrate RAILS_ENV="production" --trace

* Invoke db:migrate (first_time) * Invoke environment (first_time) \ Execute environment rake aborted!

PG::UndefinedTable: ERROR: relation "settings" does not exist LINE 5: WHERE a.attrelid = '"settings"'::regclass ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"settings"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum

/home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:1163:in exec' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:1163:inexec_no_cache' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:660:in block in exec_query' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract_adapter.rb:280:inblock in log' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activesupport-3.2.14/lib/active_support/notifications/instrumenter.rb:20:in instrument' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract_adapter.rb:275:inlog' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:659:in exec_query' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:1292:incolumn_definitions' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-3.2.14/lib/active_record/connection_adapters/postgresql_adapter.rb:855:in columns' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-3.2.14/lib/active_record/connection_adapters/schema_cache.rb:12:inblock in initialize' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-3.2.14/lib/active_record/model_schema.rb:229:in yield' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-3.2.14/lib/active_record/model_schema.rb:229:indefault' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-3.2.14/lib/active_record/model_schema.rb:229:in columns' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-3.2.14/lib/active_record/model_schema.rb:249:incolumn_names' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-3.2.14/lib/active_record/model_schema.rb:262:in column_methods_hash' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-3.2.14/lib/active_record/dynamic_matchers.rb:74:inall_attributes_exists?' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activerecord-3.2.14/lib/active_record/dynamic_matchers.rb:27:in method_missing' /home/harshith/testcasedb/config/initializers/omniauth.rb:2:inblock in <top (required)>' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rack-1.4.5/lib/rack/builder.rb:51:in instance_eval' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rack-1.4.5/lib/rack/builder.rb:51:ininitialize' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/omniauth-1.1.3/lib/omniauth/builder.rb:7:in initialize' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/actionpack-3.2.14/lib/action_dispatch/middleware/stack.rb:43:innew' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/actionpack-3.2.14/lib/action_dispatch/middleware/stack.rb:43:in build' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/actionpack-3.2.14/lib/action_dispatch/middleware/stack.rb:113:inblock in build' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/actionpack-3.2.14/lib/action_dispatch/middleware/stack.rb:113:in each' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/actionpack-3.2.14/lib/action_dispatch/middleware/stack.rb:113:ininject' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/actionpack-3.2.14/lib/action_dispatch/middleware/stack.rb:113:in build' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/railties-3.2.14/lib/rails/engine.rb:475:inapp' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/railties-3.2.14/lib/rails/application/finisher.rb:31:in block in <module:Finisher>' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/railties-3.2.14/lib/rails/initializable.rb:30:ininstance_exec' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/railties-3.2.14/lib/rails/initializable.rb:30:in run' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/railties-3.2.14/lib/rails/initializable.rb:55:inblock in run_initializers' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/railties-3.2.14/lib/rails/initializable.rb:54:in each' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/railties-3.2.14/lib/rails/initializable.rb:54:inrun_initializers' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/railties-3.2.14/lib/rails/application.rb:136:in initialize!' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/railties-3.2.14/lib/rails/railtie/configurable.rb:30:inmethod_missing' /home/harshith/testcasedb/config/environment.rb:5:in <top (required)>' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:inrequire' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in block in require' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:236:inload_dependency' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in require' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/railties-3.2.14/lib/rails/application.rb:103:inrequire_environment!' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/railties-3.2.14/lib/rails/application.rb:305:in block (2 levels) in initialize_tasks' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/task.rb:236:incall' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/task.rb:236:in block in execute' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/task.rb:231:ineach' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/task.rb:231:in execute' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/task.rb:175:inblock in invoke_with_call_chain' /home/harshith/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/monitor.rb:211:in mon_synchronize' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/task.rb:168:ininvoke_with_call_chain' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/task.rb:197:in block in invoke_prerequisites' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/task.rb:195:ineach' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/task.rb:195:in invoke_prerequisites' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/task.rb:174:inblock in invoke_with_call_chain' /home/harshith/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/monitor.rb:211:in mon_synchronize' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/task.rb:168:ininvoke_with_call_chain' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/task.rb:161:in invoke' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/application.rb:149:ininvoke_task' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/application.rb:106:in block (2 levels) in top_level' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/application.rb:106:ineach' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/application.rb:106:in block in top_level' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/application.rb:115:inrun_with_threads' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/application.rb:100:in top_level' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/application.rb:78:inblock in run' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/application.rb:165:in standard_exception_handling' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/lib/rake/application.rb:75:inrun' /home/harshith/.rvm/gems/ruby-1.9.3-p547/gems/rake-10.1.0/bin/rake:33:in <top (required)>' /home/harshith/.rvm/gems/ruby-1.9.3-p547/bin/rake:23:inload' /home/harshith/.rvm/gems/ruby-1.9.3-p547/bin/rake:23:in <main>' /home/harshith/.rvm/gems/ruby-1.9.3-p547/bin/ruby_executable_hooks:15:ineval' /home/harshith/.rvm/gems/ruby-1.9.3-p547/bin/ruby_executable_hooks:15:in `

' Tasks: TOP => db:migrate => environment

kirantpatil commented 10 years ago

Just to test, I commented omniauth from gemfile, contents from 'config/initializers/omniauth.rb' and did git reset to fcb8f5 and then did db:migrate and now it migrates.

So it is clearly related to omniauth.

harshith30 commented 10 years ago

Hi, After the latest git pull ,i'm able to migrate the DB as well as precompile it , that resolved this issue so closing it. Thanks