diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-06-02 12:36:36 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-06-02 12:36:36 -0300 |
commit | fd3c55f09fdfb45c33a5383af2c0b9ddf8f63e90 (patch) | |
tree | 89f6b8eeae81ba9e9f3c43667b234b64a776e649 /activerecord/lib/active_record/schema_dumper.rb | |
parent | 5255a81b808c2c947d58df979e6436b1fe1d8157 (diff) | |
parent | 196f780e30fcece25e4d09c12f9b9f7374ebed29 (diff) | |
download | rails-fd3c55f09fdfb45c33a5383af2c0b9ddf8f63e90.tar.gz rails-fd3c55f09fdfb45c33a5383af2c0b9ddf8f63e90.tar.bz2 rails-fd3c55f09fdfb45c33a5383af2c0b9ddf8f63e90.zip |
Merge commit 'rails/master'
Conflicts:
activerecord/lib/active_record.rb
Diffstat (limited to 'activerecord/lib/active_record/schema_dumper.rb')
-rw-r--r-- | activerecord/lib/active_record/schema_dumper.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index de530a3456..2d90ef35aa 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -99,8 +99,15 @@ HEADER next if column.name == pk spec = {} spec[:name] = column.name.inspect - spec[:type] = column.type.to_s - spec[:limit] = column.limit.inspect if column.limit != @types[column.type][:limit] && column.type != :decimal + + # AR has an optimisation which handles zero-scale decimals as integers. This + # code ensures that the dumper still dumps the column as a decimal. + spec[:type] = if column.type == :integer && [/^numeric/, /^decimal/].any? { |e| e.match(column.sql_type) } + 'decimal' + else + column.type.to_s + end + spec[:limit] = column.limit.inspect if column.limit != @types[column.type][:limit] && spec[:type] != 'decimal' spec[:precision] = column.precision.inspect if !column.precision.nil? spec[:scale] = column.scale.inspect if !column.scale.nil? spec[:null] = 'false' if !column.null |