heroku - Fail to select the record in rails 5 console -


i have tested new rails code on c9.io , working fine select record when emailreceived field false on invitation table,

after updated new code heroku, failed it. , showing error message.

activerecord::statementinvalid: pg::undefinedcolumn: error: column "emailreceived" not exist

i used invitation.column_names , can find "emailreceived". database corrupted? here console information reference. please advise how fix it.

irb(main):005:0> invitation.column_names => ["id", "church", "telephone1", "telephone2", "worshiptime", "contactname", "contactnumber", "priest", "preacher", "emailreceived", "acceptpromote", "promotiontime", "other", "created_at", "updated_at"] irb(main):006:0> invitation.where("emailreceived = false") invitation load (3.0ms) select "invitations".* "invitations" (emailreceived = false) activerecord::statementinvalid: pg::undefinedcolumn: error: column "emailreceived" not exist line 1: select "invitations".* "invitations" (emailreceiv... ^ hint: perhaps meant reference column "invitations.emailreceived". : select "invitations".* "invitations" (emailreceived = false) /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:598:in async_exec' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:598:inblock in exec_no_cache' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:566:in block in log' /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/notifications/instrumenter.rb:21:ininstrument' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:560:in log' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:598:inexec_no_cache' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:585:in execute_and_clear' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:103:inexec_query' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:373:in select' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:41:inselect_all' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/query_cache.rb:70:in select_all' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/querying.rb:39:infind_by_sql' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/relation.rb:699:in exec_queries' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/relation.rb:580:inload' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/relation.rb:260:in records' /app/vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0.1/lib/active_record/relation.rb:683:ininspect' /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in start' /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:instart' /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in console' /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:inrun_command!' /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in <top (required)>' bin/rails:8:inrequire' bin/rails:8:in `'irb(main):007:0> 

one more information on case, run "heroku run rake --trace db:migrate version=20161007083159" , below result. , still doesn't work

heroku run rake --trace db:migrate version=20161007083159 running rake --trace db:migrate version=20161007083159 on ⬢ shrouded-scrubland-30708... up, run.1694 ** invoke db:migrate (first_time) ** invoke environment (first_time) ** execute environment ** invoke db:load_config (first_time) ** execute db:load_config ** execute db:migrate   activerecord::schemamigration load (0.6ms)  select "schema_migrations".* "schema_migrations"   activerecord::schemamigration load (0.5ms)  select "schema_migrations".* "schema_migrations"    (0.5ms)  select pg_try_advisory_lock(129277373589159705);   activerecord::schemamigration load (0.5ms)  select "schema_migrations".* "schema_migrations"   activerecord::internalmetadata load (0.8ms)  select  "ar_internal_metadata".* "ar_internal_metadata" "ar_internal_metadata"."key" = $1 limit $2  [["key", :environment], ["limit", 1]]    (0.5ms)  begin    (0.4ms)  commit    (0.5ms)  select pg_advisory_unlock(129277373589159705) ** invoke db:_dump (first_time) ** execute db:_dump 

thanks

patrick lee

eventually, found problem occurred due case sensitive of postgresql. changed code invitation.where("emailreceived ? or emailreceived = ?", nil,false) invitation.where("emailreceived" => nil) on model.

but 1 more question, how can use or invitation.where("emailreceived" => nil) invitation.where("emailreceived" => false)?

thanks

patrick lee


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -