When creating a table in a Rails migration, you have to specify data types using platform-agnostic names. The mapping of Rails types onto DB2 types is defined in ibm_db_adapter.rb:
:primary_key => @servertype.primary_key,
:string => { :name => "varchar", :limit => 255 },
:text => { :name => "clob" },
:integer => { :name => "integer" },
:float => { :name => "float" },
:datetime => { :name => "timestamp" },
:timestamp => { :name => "timestamp" },
:time => { :name => "time" },
:date => { :name => "date" },
:binary => { :name => "blob" },
# A boolean can be represented by a smallint,
# adopting the convention that False is 0 and True is 1
:boolean => { :name => "smallint"},
:xml => { :name => "xml"},
:decimal => { :name => "decimal" }
Useful Resources
InfoCenter | DB2 Data Types
dW | DB2 and Ruby on Rails, Part 1 (May 2007)
dW | An Introduction to Ruby on Rails for DB2 Developers (June 2006)
The DB2 adapter is now called ibm_db. You can refresh your installation by typing gem install ibm_db at the command line and choosing the latest win32 release.
Leave a Reply