-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
In a Rails 7.1 application, if I try to supply algorithm: :default
to add_index
:
add_index :some_table, [:some_column], algorithm: :default
then I get an error like this:
StandardError: An error has occurred, all later migrations canceled: (StandardError)
Algorithm must be one of the following: :concurrently
ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-7.1.5.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:1470:in `block in index_algorithm'
ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-7.1.5.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:1469:in `fetch'
iiuc, Rails is hitting that check & error condition before this safe-pg-migrations code can kick in:
def add_index(table_name, column_name, **options) | |
if options[:algorithm] == :default | |
options.delete :algorithm | |
else | |
options[:algorithm] = :concurrently | |
end |
Metadata
Metadata
Assignees
Labels
No labels