Changeset 7665
- Timestamp:
- 09/28/07 14:10:51 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
r7521 r7665 409 409 def change_column(table_name, column_name, type, options = {}) #:nodoc: 410 410 unless options_include_default?(options) 411 options[:default] = select_one("SHOW COLUMNS FROM #{table_name} LIKE '#{column_name}'")["Default"] 411 if result = select_one("SHOW COLUMNS FROM #{table_name} LIKE '#{column_name}'") 412 options[:default] = result['Default'] 413 else 414 raise "No such column: #{table_name}.#{column_name}" 415 end 412 416 end 413 417