Skip to content

Conversation

jordan-brough
Copy link

@jordan-brough jordan-brough commented Feb 28, 2025

Attempt to address #154

Rails (at least version 7.1) raises an error if the :algorithm option is set to :default, before this code gets invoked.

Instead of allowing a custom :default option, we can instead just check whether the options[:algorithm] key is present. This is what the existing remove_index method does already:

def remove_index(table_name, column_name = nil, **options)
options[:algorithm] = :concurrently unless options.key?(:algorithm)

and this will allow us to use algorithm: nil to disable the :concurrently option.

Note: I haven't tested this change directly, but I added a monkey-patch to my own app that does essentially the same thing.

@jordan-brough jordan-brough requested a review from a team as a code owner February 28, 2025 15:41
Rails (at least version 7.1) raises an error if the `:algorithm` option is set to :default, before this code gets
invoked.

Instead of allowing a custom `:default` option, we can instead just check whether the options[:algorithm] key is
present. This is what the `remove_index` method below does, and allows us to use `algorithm: nil` to disable the
`:concurrently` option.
@jordan-brough
Copy link
Author

@CharlesDelannoy any thoughts on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant