Rails 3.1 RC4 has broken migrations also for MySQL

Rails 3.1 RC4 has broken migrations not only for PostgreSQL but also for MySQL. But that time the error is different.

$ jruby -v jruby 1.6.2 (ruby-1.8.7-p330) (2011-05-23 e2ea975) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_24) [darwin-x86_64-java]

$ jruby -S rails -v Rails 3.1.0.rc4

$ jruby -S rails new myapp -d jdbcpostgresql ... jruby -S rake db:create

$ jruby -S rails g model user name:string       invoke active_record       create db/migrate/20110609233144_create_users.rb       create app/models/user.rb       invoke test_unit       create test/unit/user_test.rb       create test/fixtures/users.yml

jruby -S rake db:migrate

$ jruby -S rake db:migrate --trace ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Invoke db:load_config (first_time) ** Invoke rails_env (first_time) ** Execute rails_env ** Execute db:load_config ** Execute db:migrate == CreateUsers: migrating

Wouldn't this be a bug in the activerecord-jdbc-adapter?

- Ken

Ken, I don't think so. When I create the same application in Rails 3.0.8 migrations do not have any errors. The problem exists only for Rails 3.1 RC4. And, yes, in both situations I use the same gems versions:

jdbc-mysql (5.1.13) activerecord-jdbc-adapter (1.1.1)

Well and that is my point. Being an external adapter author myself, I am a witness to exactly how much the activerecord-sqlserver-adapter had to change to support the 3.1 vs 3.0 code base. I would not assume the same adapter version of anything would work 100% moving from ActiveRecord 3.0 to 3.1.

Besides, just reporting problems is not enough. If have the capability some talk around what you think the problem is and even better yet some stabs at a patch would be nice. Also, have you talked to the external adapter's author and/or community too?

- Ken

Hi,

same problem with sqlite3.

c:> jruby -v jruby 1.6.2 (ruby-1.8.7-p330) (2011-05-23 e2ea975) (Java HotSpot(TM) Client VM 1.6.0_25) [Windows XP-x86-java]

c:> jgem list ... activerecord-jdbcsqlite3-adapter (1.1.1) rails (3.1.0.rc4) ...

c:> jruby -S rails s ... ArgumentError: wrong number of arguments (3 for 2)         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/l ib/active_record/connection_adapters/abstract/database_statements.rb: 9:in `selec t_all'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/l ib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/l ib/active_record/connection_adapters/abstract/query_cache.rb:74:in `cache_sql'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/l ib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/l ib/active_record/base.rb:473:in `find_by_sql'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/l ib/active_record/relation.rb:109:in `to_a'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/l ib/active_record/relation/finder_methods.rb:370:in `find_first'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/l ib/active_record/relation/finder_methods.rb:122:in `first'         from org/jruby/RubyKernel.java:2059:in `send'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/l ib/active_record/relation/finder_methods.rb:257:in `find_by_attributes'         from org/jruby/RubyKernel.java:2071:in `send'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/l ib/active_record/base.rb:1060:in `method_missing'         from (irb):1:in `evaluate'         from org/jruby/RubyKernel.java:1088:in `eval'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ruby- debug-0.10.4/cli/ru by-debug/commands/irb.rb:99:in `evaluate'         from c:/java/jruby-1.6.2/lib/ruby/1.8/irb.rb:158:in `eval_input' ... 78 levels...         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack- mount-0.8.1/lib/rac k/mount/route_set.rb:152:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack- mount-0.8.1/lib/rac k/mount/code_generation.rb:111:in `recognize'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack- mount-0.8.1/lib/rac k/mount/code_generation.rb:80:in `optimized_each'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack- mount-0.8.1/lib/rac k/mount/code_generation.rb:110:in `recognize'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack- mount-0.8.1/lib/rac k/mount/route_set.rb:141:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ actionpack-3.1.0.rc4/lib /action_dispatch/routing/route_set.rb:531:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ actionpack-3.1.0.rc4/lib /action_dispatch/middleware/best_standards_support.rb:17:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/ rack/etag .rb:23:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/ rack/cond itionalget.rb:25:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ actionpack-3.1.0.rc4/lib /action_dispatch/middleware/head.rb:14:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ actionpack-3.1.0.rc4/lib /action_dispatch/middleware/params_parser.rb:21:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ actionpack-3.1.0.rc4/lib /action_dispatch/middleware/flash.rb:243:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/ rack/sess ion/abstract/id.rb:195:in `context'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/ rack/sess ion/abstract/id.rb:190:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ actionpack-3.1.0.rc4/lib /action_dispatch/middleware/cookies.rb:321:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/l ib/active_record/query_cache.rb:54:in `call'irb(User):002:0>

I am happy to help out here, if I get some little hints where I can find these internal API changes from3.0 -> 3.1

a quick fix to get the migration and scaffold application working is no problem (commenting out the bind parameter in some method calls) but the moment you start a real application that will not work.

- Kristian

Hi, same with jruby 1.6.2/rails 3.1.0.rc4/sqlite3. But works with MRI 1.9.2.

c:>jruby -v jruby 1.6.2 (ruby-1.8.7-p330) (2011-05-23 e2ea975) (Java HotSpot(TM) Client VM 1.6.0_25) [Windows XP-x86-java] c:>jgem list ... activerecord-jdbcsqlite3-adapter (1.1.1) rails (3.1.0.rc4) ...

c:>jruby -S rails s ... ArgumentError: wrong number of arguments (3 for 2)         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/ database_statements.rb:9:in `select_all'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/ query_cache.rb:60:in `select_all'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/ query_cache.rb:74:in `cache_sql'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/ query_cache.rb:60:in `select_all'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/lib/active_record/base.rb:473:in `find_by_sql'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/lib/active_record/relation.rb:109:in `to_a'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/lib/active_record/relation/finder_methods.rb: 370:in `find_first'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/lib/active_record/relation/finder_methods.rb: 122:in `first'         from org/jruby/RubyKernel.java:2059:in `send'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/lib/active_record/relation/finder_methods.rb: 257:in `find_by_attributes'         from org/jruby/RubyKernel.java:2071:in `send'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/lib/active_record/base.rb:1060:in `method_missing'         from (irb):1:in `evaluate'         from org/jruby/RubyKernel.java:1088:in `eval'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ruby- debug-0.10.4/cli/ruby-debug/commands/irb.rb:99:in `evaluate'         from c:/java/jruby-1.6.2/lib/ruby/1.8/irb.rb:158:in `eval_input' ... 78 levels...         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack- mount-0.8.1/lib/rack/mount/route_set.rb:152:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack- mount-0.8.1/lib/rack/mount/code_generation.rb:111:in `recognize'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack- mount-0.8.1/lib/rack/mount/code_generation.rb:80:in `optimized_each'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack- mount-0.8.1/lib/rack/mount/code_generation.rb:110:in `recognize'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack- mount-0.8.1/lib/rack/mount/route_set.rb:141:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ actionpack-3.1.0.rc4/lib/action_dispatch/routing/route_set.rb:531:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ actionpack-3.1.0.rc4/lib/action_dispatch/middleware/ best_standards_support.rb:17:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/ rack/etag.rb:23:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/ rack/conditionalget.rb:25:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ actionpack-3.1.0.rc4/lib/action_dispatch/middleware/head.rb:14:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ actionpack-3.1.0.rc4/lib/action_dispatch/middleware/params_parser.rb: 21:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ actionpack-3.1.0.rc4/lib/action_dispatch/middleware/flash.rb:243:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/ rack/session/abstract/id.rb:195:in `context'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/ rack/session/abstract/id.rb:190:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ actionpack-3.1.0.rc4/lib/action_dispatch/middleware/cookies.rb:321:in `call'         from c:/java/jruby-1.6.2/lib/ruby/gems/1.8/gems/ activerecord-3.1.0.rc4/lib/active_record/query_cache.rb:54:in `call'irb(User):002:0>

Anyone found a solution to this as yet?

Ketan studios.thoughtworks.com | twitter.com/ketanpkr

Having the same error. Did anyone got it working?

Ken Collins is correct. It's not that migrations are broken in Rails 3.1 RC4, but rather the ActiveRecord API has changed and the adapter has not yet caught up.

This issue appears to have already been fixed in the activerecord-jdbc- adapter source, but there hasn't been a new 1.1.3 release yet, which isn't surprising given that Rails 3.1 hasn't been released yet. If you want to run it now, then add the following to your Gemfile:

gem 'activerecord-jdbcpostgresql-adapter', :git => 'https://github.com/ nicksieger/activerecord-jdbc-adapter.git'

Scott

Correction to previous message:

You’ve probably spotted (and guessed) that my gem string was slightly incorrect and should have read ‘activerecord-jdbc-adapter’ and not '‘activerecord-jdbcpostgresql-adapter’; but the principle is there.

Doh!

In any case, migrations are working for me with Postgres and the latest JDBC adapter from master.

Scott