-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
Conversation
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we deprecate this argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
3951f70
to
16d2239
Compare
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the deprecation message.
914ef90
to
a5f2e4b
Compare
80f1c9e
to
d31a104
Compare
d31a104
to
70cfd76
Compare
70cfd76
to
272b1db
Compare
272b1db
to
830f196
Compare
3ba087f
to
d99ce24
Compare
d99ce24
to
1e424b1
Compare
75eae94
to
2739378
Compare
The `default` arg of `index_name_exists?` is only used the adapter does not implemented `indexes`. But currently all adapters implemented `indexes` (See rails#26688). Therefore the `default` arg is never used.
2739378
to
28dc6d7
Compare
The
default
arg ofindex_name_exists?
is only used the adapter doesnot implemented
indexes
. But currently all adapters implementedindexes
(See #26688). Therefore thedefault
arg is never used.