I ran into a bug/issue where running rake db:migrate under JRuby with a
mysql DB and a type of boolean produces the following error. Is this a
known bug/issue with rake under JRuby ?
Rake Output (0.8.1):
– add_column(:clips, :featured, :bool, {:default=>false})
rake aborted!
ActiveRecord::ActiveRecordError: You have an error in your SQL syntax;
check
the manual that corresponds to your MySQL server version for the right
syntax to use near ‘(1) DEFAULT 0’ at line 1: ALTER TABLE clips ADD featured bool(1) DEFAULT 0
I ran into a bug/issue where running rake db:migrate under JRuby with a
mysql DB and a type of boolean produces the following error. Is this a
known bug/issue with rake under JRuby ?
it helps and it worked.
Any reason it works in MRI rake and not JRuby rake ?
No particular reason. My best guess is that MRI’s mysql adapter has a
mapping for :bool, while AR-JDBC does not? Not sure…
I’ve run into this before with :int and :integer. I think AR just passes
the column type through to the DB in many cases [2], so if the adapter
and/or DB supports calling “boolean” “bool”, then it’ll work. So the
difference you’re seeing is most likely a difference between using the
regular mysql adapter vs. activerecord-jdbc’s mysql adapter. Since
:boolean is the correct name for the type [1], ar-jdbc is probably more
correct.
[1]
[2] It looks like it tries to translate it, and if it doesn’t recognize
the type, it just passes it through.