Changeset 5944
- Timestamp:
- 01/15/07 15:48:38 (2 years ago)
- Files:
-
- trunk/activerecord/CHANGELOG (modified) (1 diff)
- trunk/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb (modified) (3 diffs)
- trunk/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb (modified) (1 diff)
- trunk/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r5937 r5944 1 1 *SVN* 2 2 3 * change_column accepts :default => nil. #6956[dcmanges, Jeremy Kemper]3 * change_column accepts :default => nil. Skip column options for primary keys. #6956, #7048 [dcmanges, Jeremy Kemper] 4 4 5 5 * MySQL, PostgreSQL: change_column_default quotes the default value and doesn't lose column type information. #3987, #6664 [Jonathan Viney, manfred, altano@bigfoot.com] trunk/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
r5937 r5944 204 204 205 205 class ColumnDefinition < Struct.new(:base, :name, :type, :limit, :precision, :scale, :default, :null) #:nodoc: 206 207 def sql_type 208 base.type_to_sql(type.to_sym, limit, precision, scale) rescue type 209 end 210 206 211 def to_sql 207 column_sql = "#{base.quote_column_name(name)} #{ type_to_sql(type.to_sym, limit, precision, scale)}"208 add_column_options!(column_sql, :null => null, :default => default) 212 column_sql = "#{base.quote_column_name(name)} #{sql_type}" 213 add_column_options!(column_sql, :null => null, :default => default) unless type.to_sym == :primary_key 209 214 column_sql 210 215 end … … 212 217 213 218 private 214 def type_to_sql(name, limit, precision, scale)215 base.type_to_sql(name, limit, precision, scale) rescue name216 end217 219 218 220 def add_column_options!(sql, options) … … 234 236 # Can be called multiple times, but this is probably not a good idea. 235 237 def primary_key(name) 236 column(name, native[:primary_key])238 column(name, :primary_key) 237 239 end 238 240 trunk/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
r5937 r5944 255 255 def type_to_sql(type, limit = nil, precision = nil, scale = nil) #:nodoc: 256 256 native = native_database_types[type] 257 column_type_sql = native [:name]257 column_type_sql = native.is_a?(Hash) ? native[:name] : native 258 258 if type == :decimal # ignore limit, use precison and scale 259 259 precision ||= native[:precision] trunk/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb
r5933 r5944 173 173 def quote(value, column = nil) #:nodoc: 174 174 if column && [:text, :binary].include?(column.type) 175 %Q{empty_#{ column.sql_type rescue 'blob' }()}175 %Q{empty_#{ column.sql_type.downcase rescue 'blob' }()} 176 176 else 177 177 super