Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Don't carry default value when changing column for a binary t…

…ype on MySQL"

Broke mysql tests.

This reverts commit ddadcc7.

Conflicts:

	activerecord/test/cases/migration_test.rb

[#3234 state:open]
  • Loading branch information...
commit 9d99e610be0da6e4b682ebb8cc410cdca1ca633a 1 parent 99bcce7
@jeremy jeremy authored
View
6 activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -506,7 +506,7 @@ def change_column_null(table_name, column_name, null, default = nil)
def change_column(table_name, column_name, type, options = {}) #:nodoc:
column = column_for(table_name, column_name)
- if has_default?(type) && !options_include_default?(options)
+ unless options_include_default?(options)
options[:default] = column.default
end
@@ -655,10 +655,6 @@ def column_for(table_name, column_name)
end
column
end
-
- def has_default?(sql_type)
- sql_type =~ :binary || sql_type == :text #mysql forbids defaults on blob and text columns
- end
end
end
end
View
12 activerecord/test/cases/migration_test.rb
@@ -857,18 +857,6 @@ def test_change_column_default
assert_equal "Tester", Person.new.first_name
end
- unless current_adapter?(:PostgreSQLAdapter)
- def test_change_column_type_default_should_change
- old_columns = Person.connection.columns(Person.table_name, "#{name} Columns")
- assert !old_columns.find { |c| c.name == 'data' }
-
- assert_nothing_raised do
- Person.connection.add_column "people", "data", :string, :default => ''
- Person.connection.change_column "people", "data", :binary
- end
- end
- end
-
def test_change_column_quotes_column_names
Person.connection.create_table :testings do |t|
t.column :select, :string
Please sign in to comment.
Something went wrong with that request. Please try again.