Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Revert "Don't carry default value when changing column for a binary t…
…ype on MySQL"

Broke mysql tests.

This reverts commit edec1af.

Conflicts:

	activerecord/test/cases/migration_test.rb

[#3234 state:open]
  • Loading branch information
jeremy committed May 18, 2010
1 parent 3809c80 commit 223d641
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
Expand Up @@ -513,7 +513,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

Expand Down Expand Up @@ -675,10 +675,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
12 changes: 0 additions & 12 deletions activerecord/test/cases/migration_test.rb
Expand Up @@ -894,18 +894,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
Expand Down

0 comments on commit 223d641

Please sign in to comment.