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

Fix default options argument on ActiveRecord::ConnectionAdaptors::Table#column_exists? #1763

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def column(column_name, type, options = {})
end

# Checks to see if a column exists. See SchemaStatements#column_exists?
def column_exists?(column_name, type = nil, options = nil)
def column_exists?(column_name, type = nil, options = {})
@base.column_exists?(@table_name, column_name, type, options)
end

Expand Down
12 changes: 12 additions & 0 deletions activerecord/test/cases/migration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,18 @@ def test_column_exists_with_definition
Person.connection.drop_table :testings rescue nil
end

def test_column_exists_on_table_with_no_options_parameter_supplied
Person.connection.create_table :testings do |t|
t.string :foo
end
Person.connection.change_table :testings do |t|
assert t.column_exists?(:foo)
assert !(t.column_exists?(:bar))
end
ensure
Person.connection.drop_table :testings rescue nil
end

def test_add_table
assert !Reminder.table_exists?

Expand Down