Changeset 8439
- Timestamp:
- 12/19/07 09:31:57 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r8419 r8439 1 *SVN* 2 3 * Ruby 1.9 compatibility. [Jeremy Kemper] 4 5 1 6 *2.0.2* (December 16th, 2007) 2 7 trunk/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
r8304 r8439 418 418 def column(name, type, options = {}) 419 419 column = self[name] || ColumnDefinition.new(@base, name, type) 420 column.limit = options[:limit] || native[type.to_sym][:limit] if options[:limit] or native[type.to_sym] 420 if options[:limit] 421 column.limit = options[:limit] 422 elsif native[type.to_sym].is_a?(Hash) 423 column.limit = native[type.to_sym][:limit] 424 end 421 425 column.precision = options[:precision] 422 426 column.scale = options[:scale] trunk/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
r8113 r8439 256 256 if native = native_database_types[type] 257 257 column_type_sql = native.is_a?(Hash) ? native[:name] : native 258 258 259 if type == :decimal # ignore limit, use precision and scale 259 precision ||= native[:precision]260 260 scale ||= native[:scale] 261 if precision 261 262 if precision ||= native[:precision] 262 263 if scale 263 264 column_type_sql << "(#{precision},#{scale})" … … 265 266 column_type_sql << "(#{precision})" 266 267 end 267 els e268 raise ArgumentError, "Error adding decimal column: precision cannot be empty if scale if specified" if scale268 elsif scale 269 raise ArgumentError, "Error adding decimal column: precision cannot be empty if scale if specified" 269 270 end 270 column_type_sql 271 else 272 limit ||= native[:limit] 273 column_type_sql << "(#{limit})" if limit 274 column_type_sql 271 272 elsif limit ||= native.is_a?(Hash) && native[:limit] 273 column_type_sql << "(#{limit})" 275 274 end 275 276 column_type_sql 276 277 else 277 column_type_sql =type278 type 278 279 end 279 280 end