jeudi 3 août 2017

Rails 3 to Rails 5 migration ActiveRecord issue

Rails upgrade from 2.3.8 to 5.1.2 with Jruby

ActiveRecord issue when upgrading gem 'activerecord-jdbc-adapter'

I started to work as a junior Rails developer and my first task is to update a legacy Rails 2.3.8 app written around 2008 in Jruby 1.5.3 (Ruby 1.8.7) to Rails 5.1.2 in Jruby 9.1.12 (Ruby 2.3.3). It consists of 222 controllers and 122 models, and only spits XML that is consumed by a Java Swing desktop app. Searching I found that the best way to do it, is step by step from one minor version to another correcting all issues in the inter. I reached version 3.0.12 in two weeks leaving the aplication without warnings, but I was asked to go directly to Jruby 9.X.X and Rails 5.1.X. With a few difficulties I get the server up, but when I try to login in the application I got this error. I suspect about the jdbc adapter gem, but any gem below 5.0pre1 works with Rails 5. Could this be only a parsing error from the DB? Should I continue with the cycle I was carrying?

NOTE: There's no test suite for the app, and there are eight modules that override some Rails core methods.

Started POST "/login/login_xml" for 127.0.0.1 at 2017-08-03 12:21:03 -0500
  ActiveRecord::SchemaMigration Load (0.0ms)  SELECT `schema_migrations`.* 
FROM `schema_migrations`

NoMethodError (undefined method `to_sym' for nil:NilClass
Did you mean?  to_s):

activerecord (5.0.4) lib/active_record/attribute_methods/time_zone_conversion.rb:88:in `create_time_zone_conversion_attribute?'
activerecord (5.0.4) lib/active_record/attribute_methods/time_zone_conversion.rb:78:in `block in inherited'
activerecord (5.0.4) lib/active_record/attribute_decorators.rb:62:in `block in matching'
org/jruby/RubyArray.java:2565:in `select'
activerecord (5.0.4) lib/active_record/attribute_decorators.rb:61:in `matching'
activerecord (5.0.4) lib/active_record/attribute_decorators.rb:57:in `decorators_for'
activerecord (5.0.4) lib/active_record/attribute_decorators.rb:48:in `apply'
activerecord (5.0.4) lib/active_record/attribute_decorators.rb:30:in `block in load_schema!'
org/jruby/RubyHash.java:1343:in `each'
activerecord (5.0.4) lib/active_record/attribute_decorators.rb:29:in `load_schema!'
activerecord (5.0.4) lib/active_record/model_schema.rb:455:in `block in load_schema'
C:/jruby-9.1.12.0/lib/ruby/stdlib/monitor.rb:214:in `mon_synchronize'
activerecord (5.0.4) lib/active_record/model_schema.rb:452:in `load_schema'
activerecord (5.0.4) lib/active_record/model_schema.rb:343:in `columns_hash'
activerecord (5.0.4) lib/active_record/querying.rb:41:in `find_by_sql'
activerecord (5.0.4) lib/active_record/relation.rb:702:in `exec_queries'
activerecord (5.0.4) lib/active_record/relation.rb:583:in `load'
activerecord (5.0.4) lib/active_record/relation.rb:260:in `records'
activerecord (5.0.4) lib/active_record/relation/delegation.rb:38:in `map'
activerecord (5.0.4) lib/active_record/migration.rb:1031:in `block in get_all_versions'
activesupport (5.0.4) lib/active_support/deprecation/reporting.rb:36:in `silence'
activesupport (5.0.4) lib/active_support/deprecation/instance_delegator.rb:20:in `silence'
activerecord (5.0.4) lib/active_record/migration.rb:1029:in `get_all_versions'
activerecord (5.0.4) lib/active_record/migration.rb:1043:in `needs_migration?'
activerecord (5.0.4) lib/active_record/migration.rb:573:in `check_pending!'
activerecord (5.0.4) lib/active_record/migration.rb:549:in `call'
actionpack (5.0.4) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.4) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.4) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.4) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.4) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.4) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.4) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.4) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
actionpack (5.0.4) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.4) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.4) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.4) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.0.4) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.4) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.0.4) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.0.4) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.3) lib/rack/method_override.rb:22:in `call'
rack (2.0.3) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.4) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.4) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.4) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.3) lib/rack/sendfile.rb:111:in `call'
railties (5.0.4) lib/rails/engine.rb:522:in `call'
puma-3.9.1 (java) lib/puma/configuration.rb:224:in `call'
puma-3.9.1 (java) lib/puma/server.rb:602:in `handle_request'
puma-3.9.1 (java) lib/puma/server.rb:435:in `process_client'
puma-3.9.1 (java) lib/puma/server.rb:299:in `block in run'
puma-3.9.1 (java) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
  Rendering C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/actionpack-5.0.4/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
  Rendering C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/actionpack-5.0.4/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
  Rendered C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/actionpack-5.0.4/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (16.0ms)
  Rendering C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/actionpack-5.0.4/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
  Rendered C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/actionpack-5.0.4/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (16.0ms)
  Rendering C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/actionpack-5.0.4/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
  Rendered C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/actionpack-5.0.4/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (12.0ms)
  Rendered C:/jruby-9.1.12.0/lib/ruby/gems/shared/gems/actionpack-5.0.4/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (142.0ms)

Aucun commentaire:

Enregistrer un commentaire