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

The `default` arg of `index_name_exists?` makes to optional #26930

Merged
merged 2 commits into from Feb 13, 2017

Conversation

Projects
None yet
6 participants
@kamipo
Member

kamipo commented Oct 29, 2016

The default arg of index_name_exists? is only used the adapter does
not implemented indexes. But currently all adapters implemented
indexes (See #26688). Therefore the default arg is never used.

@rails-bot

This comment has been minimized.

Show comment
Hide comment
@rails-bot

rails-bot Oct 29, 2016

r? @chancancode

(@rails-bot has picked a reviewer for you, use r? to override)

rails-bot commented Oct 29, 2016

r? @chancancode

(@rails-bot has picked a reviewer for you, use r? to override)

# as there's no way to determine the correct answer in that case.
def index_name_exists?(table_name, index_name, default)
return default unless respond_to?(:indexes)
def index_name_exists?(table_name, index_name, default = nil)

This comment has been minimized.

@rafaelfranca

rafaelfranca Oct 29, 2016

Member

Can we deprecate this argument?

@rafaelfranca

rafaelfranca Oct 29, 2016

Member

Can we deprecate this argument?

This comment has been minimized.

@pixeltrix

pixeltrix Oct 30, 2016

Member

Does anyone actually use this method externally? When I added the index_exists? (and column_exists?) methods in 11ff3da I renamed this method from index_exists? because it seemed to only be used internally at the time and was added as part of a general refactoring of add_index and remove_index in 99bcce7. I was wandering whether the whole method should be deprecated and made private?

@pixeltrix

pixeltrix Oct 30, 2016

Member

Does anyone actually use this method externally? When I added the index_exists? (and column_exists?) methods in 11ff3da I renamed this method from index_exists? because it seemed to only be used internally at the time and was added as part of a general refactoring of add_index and remove_index in 99bcce7. I was wandering whether the whole method should be deprecated and made private?

def index_name_exists?(table_name, index_name, default = nil)
unless default.nil?
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Passing default to #index_name_exists? is deprecated without replacement.

This comment has been minimized.

@kamipo

kamipo Nov 3, 2016

Member

I added the deprecation message.

@kamipo

kamipo Nov 3, 2016

Member

I added the deprecation message.

kamipo added some commits Oct 2, 2016

The `default` arg of `index_name_exists?` makes to optional
The `default` arg of `index_name_exists?` is only used the adapter does
not implemented `indexes`. But currently all adapters implemented
`indexes` (See #26688). Therefore the `default` arg is never used.

@rafaelfranca rafaelfranca merged commit e0d0dc6 into rails:master Feb 13, 2017

2 checks passed

codeclimate no new or fixed issues
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@kamipo kamipo deleted the kamipo:index_name_exists_default branch Feb 13, 2017

yahonda added a commit to yahonda/oracle-enhanced that referenced this pull request Feb 13, 2017

yahonda added a commit to yahonda/oracle-enhanced that referenced this pull request Feb 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment