Project

General

Profile

NULL pointer given on db:migrate SaltUserPasswords?

Added by Pok Lau almost 12 years ago

Was trying to upgrade from 1.1.0 to 1.4.1 and hHaving this problem when trying to initiate the database

Ruby version: ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
Rails version: Rails 2.3.14
Database: Server version: 5.5.14 MySQL Community Server (GPL)

[root@redminesrv redmine-1.4.1]$ RAILS_ENV=production rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
==  SaltUserPasswords: migrating ==============================================
-- Salting user passwords, this may take some time...
rake aborted!
An error has occurred, all later migrations canceled:

NULL pointer given
(eval):3:in `each_hash'
(eval):3:in `all_hashes'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/mysql_adapter.rb:640:in `select'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:665:in `find_by_sql'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:1582:in `find_every'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:619:in `find'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/named_scope.rb:186:in `send'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/named_scope.rb:186:in `method_missing'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/base.rb:2182:in `with_scope'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/named_scope.rb:118:in `__send__'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/named_scope.rb:118:in `with_scope'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/named_scope.rb:179:in `method_missing'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/batches.rb:63:in `find_in_batches'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/batches.rb:25:in `find_each'
/opt/redmine-dev/redmine-1.4.1/app/models/user.rb:576:in `salt_unsalted_passwords!'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/transactions.rb:182:in `transaction'
/opt/redmine-dev/redmine-1.4.1/app/models/user.rb:575:in `salt_unsalted_passwords!'
./db/migrate//20110223180953_salt_user_passwords.rb:5:in `up_without_benchmarks'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:328:in `say_with_time'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:328:in `say_with_time'
./db/migrate//20110223180953_salt_user_passwords.rb:4:in `up_without_benchmarks'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:282:in `send'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:282:in `migrate'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:282:in `migrate'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:365:in `__send__'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:365:in `migrate'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:491:in `migrate'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:567:in `call'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:567:in `ddl_transaction'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:490:in `migrate'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:477:in `each'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:477:in `migrate'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:401:in `up'
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.14/lib/active_record/migration.rb:383:in `migrate'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.14/lib/tasks/databases.rake:112
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19
Tasks: TOP => db:migrate

Replies (2)

RE: NULL pointer given on db:migrate SaltUserPasswords? - Added by Pok Lau almost 12 years ago

Just for trying, I excluded the update 20110223180953_salt_user_passwords.rb by renaming the file to something else, the db migration works, but when I tried to start up on Webrick, it gave the following error:

[root@redminesrv redmine-1.4.1]$ ruby script/server -p 3004 -e production
=> Booting WEBrick
=> Rails 2.3.14 application starting on http://0.0.0.0:3004
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-06-07 12:04:15] INFO  WEBrick 1.3.1
[2012-06-07 12:04:15] INFO  ruby 1.8.7 (2011-06-30) [x86_64-linux]
[2012-06-07 12:04:15] INFO  WEBrick::HTTPServer#start: pid=22448 port=3004

Processing WelcomeController#index (for 172.17.120.63 at 2012-06-07 12:04:17) [GET]
  Parameters: {"action"=>"index", "controller"=>"welcome"}

ArgumentError (NULL pointer given):
  (eval):3:in `each_hash'
  (eval):3:in `all_hashes'
  app/models/user.rb:563:in `anonymous'
  app/models/user.rb:557:in `current'
  app/controllers/application_controller.rb:141:in `check_if_login_required'
  /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
  /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
  /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
  /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
  /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
  /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start'

Rendering /opt/redmine-dev/redmine-1.4.1/public/500.html (500 Internal Server Error)

RE: NULL pointer given on db:migrate SaltUserPasswords? - Added by Pok Lau almost 12 years ago

Looks like this is all because I am using mysql-2.8.1 as the driver. After changing the driver to mysql2, the problem is resolved.

    (1-2/2)