Changeset 7790
- Timestamp:
- 10/08/07 03:28:28 (1 year ago)
- Files:
-
- trunk/activerecord/CHANGELOG (modified) (1 diff)
- trunk/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb (modified) (1 diff)
- trunk/activerecord/test/migration_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r7787 r7790 1 1 *SVN* 2 3 * MySQL: fix change_column on not-null columns that don't accept dfeault values of ''. #6663 [Jonathan Viney, Tarmo TÀnav] 2 4 3 5 * validates_uniqueness_of behaves well with single-table inheritance. #3833 [Gabriel Gironda, rramdas, François Beausoleil, Josh Peek, Tarmo TÀnav] trunk/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
r7780 r7790 409 409 def change_column(table_name, column_name, type, options = {}) #:nodoc: 410 410 unless options_include_default?(options) 411 if result = select_one("SHOW COLUMNS FROM #{table_name} LIKE '#{column_name}'")412 options[:default] = result['Default']411 if column = columns(table_name).find { |c| c.name == column_name.to_s } 412 options[:default] = column.default 413 413 else 414 414 raise "No such column: #{table_name}.#{column_name}" trunk/activerecord/test/migration_test.rb
r7766 r7790 428 428 Person.connection.remove_column("people", "group") rescue nil 429 429 Person.connection.add_column("people", "first_name", :string) rescue nil 430 end 431 end 432 433 def test_change_type_of_not_null_column 434 assert_nothing_raised do 435 Topic.connection.change_column "topics", "written_on", :datetime, :null => false 436 Topic.reset_column_information 437 438 Topic.connection.change_column "topics", "written_on", :datetime, :null => false 439 Topic.reset_column_information 430 440 end 431 441 end