Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary assert_valid_default #25524

Merged
merged 1 commit into from
Jun 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class Column < ConnectionAdapters::Column # :nodoc:

def initialize(*)
super
assert_valid_default
extract_default
end

Expand Down Expand Up @@ -38,12 +37,6 @@ def extract_default
@default = null || strict ? nil : ''
end
end

def assert_valid_default
if blob_or_text_column? && default.present?
raise ArgumentError, "#{type} columns cannot have a default value: #{default.inspect}"
end
end
end
end
end
Expand Down
7 changes: 0 additions & 7 deletions activerecord/test/cases/column_definition_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,8 @@ def test_should_be_empty_string_default_for_mysql_binary_data_types
end

def test_should_not_set_default_for_blob_and_text_data_types
assert_raise ArgumentError do
MySQL::Column.new("title", "a", SqlTypeMetadata.new(sql_type: "blob"))
end

text_type = MySQL::TypeMetadata.new(
SqlTypeMetadata.new(type: :text))
assert_raise ArgumentError do
MySQL::Column.new("title", "Hello", text_type)
end

text_column = MySQL::Column.new("title", nil, text_type)
assert_equal nil, text_column.default
Expand Down