diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-22 19:30:02 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-22 19:30:02 +0000 |
commit | 2d24bed3a072aac1a0087ec4c4681889e49ea6a4 (patch) | |
tree | 92e365cc4d36b46c00d6e20119e2ed6cfe1e46b1 /activerecord/lib/active_record | |
parent | f46eb2ab64b43bdf8d03683904de2cd97b73d0de (diff) | |
download | rails-2d24bed3a072aac1a0087ec4c4681889e49ea6a4.tar.gz rails-2d24bed3a072aac1a0087ec4c4681889e49ea6a4.tar.bz2 rails-2d24bed3a072aac1a0087ec4c4681889e49ea6a4.zip |
Fixed DB2 adapter so nullable columns will be determines correctly now and quotes from column default values will be removed (closes #4350) [contact@maik-schmidt.de]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4013 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/db2_adapter.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/db2_adapter.rb b/activerecord/lib/active_record/connection_adapters/db2_adapter.rb index 9819c5a92a..3b81c526f2 100644 --- a/activerecord/lib/active_record/connection_adapters/db2_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/db2_adapter.rb @@ -146,9 +146,10 @@ begin stmt.columns(table_name, schema).each do |c| c_name = c[3].downcase c_default = c[12] == 'NULL' ? nil : c[12] + c_default.gsub!(/^'(.*)'$/, '\1') if !c_default.nil? c_type = c[5].downcase c_type += "(#{c[6]})" if !c[6].nil? && c[6] != '' - result << Column.new(c_name, c_default, c_type) + result << Column.new(c_name, c_default, c_type, c[17] == 'YES') end end result @@ -156,7 +157,7 @@ begin def native_database_types { - :primary_key => 'int generated by default as identity primary key', + :primary_key => 'int generated by default as identity (start with 42) primary key', :string => { :name => 'varchar', :limit => 255 }, :text => { :name => 'clob', :limit => 32768 }, :integer => { :name => 'int' }, |